Update of DetailsView with programatic DataBinding

Discussion in 'ASP .Net Web Controls' started by kamlesh, Jun 13, 2007.

  1. kamlesh

    kamlesh Guest

    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,
     
    kamlesh, Jun 13, 2007
    #1
    1. Advertising

  2. 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

    *** Sent via Developersdex http://www.developersdex.com ***
     
    ravi chandran, Jun 22, 2007
    #2
    1. Advertising

  3. kamlesh

    kamlesh Guest

    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.



    On Jun 22, 1:41 am, ravi chandran <> wrote:
    > 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
    >
    > *** Sent via Developersdexhttp://www.developersdex.com***
     
    kamlesh, Aug 1, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Tmljaw==?=

    Programatic Insantiation of WebForms

    =?Utf-8?B?Tmljaw==?=, Jan 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    329
    =?Utf-8?B?Tmljaw==?=
    Jan 16, 2004
  2. Daniel Bickett
    Replies:
    3
    Views:
    533
    Paul McGuire
    Oct 20, 2004
  3. John Hunter
    Replies:
    0
    Views:
    374
    John Hunter
    Oct 20, 2004
  4. kamlesh
    Replies:
    0
    Views:
    410
    kamlesh
    Jun 13, 2007
  5. Simon
    Replies:
    1
    Views:
    131
    Anthony Jones
    Sep 7, 2007
Loading...

Share This Page