Update of DetailsView with programatic DataBinding

K

kamlesh

Hi Experts,

I have a question on the ASP.NET 2.0 Details view control
I dont like using the SQLDataSource to bind the data to the
DetailsView control..

I dont like the idea of placing Queries in the .ASPX files...I
prefer a 3 tiered approach to development.

Am using a Custom object to bind the object to the Details View
control at run time..
When the page loads....like this

BO.TestBO bo = new BO.TestBO();
CustomObject object = bo.GetProfileInformation(1);

this.personalInfoDetailsView.AllowPaging = false;
this.interestInfoDetailsView.AllowPaging = false;

this.personalInfoDetailsView.DataSource = object;
this.personalInfoDetailsView.DataBind();


I've been trying to figure out how the client of a DetailsView should
handle the ItemUpdating event when setting the datasource
programatically.
All the examples i've come across show a declerative data source being
used. Do i need to use ObjectDataSource?

The DetailViewUpdateEventArgs always has the OldValues and NewValues
collection empty.(Keys is too).
I can't seem to get the edited values.

I can use template fields and extract the value like this in the
'ItemUpdating' event handler

TextBox tempText = personalInfoDetailsView.FindControl("txtName") as
TextBox;
if (tempText != null)
{
info.Name = tempText.Text.Trim();
}

But extracting the values like this in the 'ItemUpdating' event
handler tooo does not work..
I dont get the edited values...i get the old values...

Any ideas would be appreciated.

Thanx,
Kamlesh,
 
R

ravi chandran

Hi,

I dont want to connect using control like sqldatasource in
Details view , i want to bind data throu coding in c# ...and also
querystring also i used ... but i am connecting throu control it will
work properly but throu coding its not work


Regards,
Ravi. C
 
K

kamlesh

hey all

please refer to teh my post in this forum

http://forums.asp.net/p/1121451/1757428.aspx#1757428

It looks like we gotta use ObjectDataSource to achieve that kind of
dynamic binding.

And it looks like Microsoft wants us to place queries in the .ASPX
file.

The whole things sucks for Dynamic Binding...i mean placing the BO
method name as an attribute value in the ObjectDataSource makes the
model so restrictive....why cant we go to the Code behind and invoke
the BO when we want...????
Foe example....It is so restrictive and now we cannot even use the
session variables in our BO class as the control automatically goes to
the BO once the method specified in the ObjectDataSource is invoked.

anyway...am frustrated with these limitations with respect to dynamic
binding in ASP.NET....hope Silverlight has a better UI based
programming model.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top