Results 1 to 5 of 5

Thread: Gurus ! Dynamic controls & retrieving values...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Québec, Canada
    Posts
    212

    Gurus ! Dynamic controls & retrieving values...

    HI all, I've come across a problem and I have no clue on how to resolve this :

    I ha ev a datagrid that must display dynamic fields & value :
    [Custom field 1] (label) : [Custom Field 1 Value] (textbox)
    [Custom field 2] (label) : [Custom Field 2 Value] (textbox)
    ...
    It works, as I am adding these fields in a datagrid within its cells.
    Now, when the page has been sent and another event (after new postback) wants to retrieve values in those fields, these controls cannot be find and do not exists anymore... (Viewstate don't recognize them as part of page..)

    So, what can I do to allow user to edit custom-made fields ???

    Thanks in advance,
    Regards,

    El-Nino

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You might be able to achieve what you want by creating your own custom column control. You have to create a class and inherit from the DataGridColumn class in the System.Web.UI.WebControls namespace.

    I got this link from a book I have:
    http://aspnet.4guysfromrolla.com/articles/100202-1.aspx

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Québec, Canada
    Posts
    212
    You think that this way the viewstate will keep controls added at runtime ?
    Regards,

    El-Nino

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    I am not sure, just trying to give you some ideas. I have looked around a bit, and that seemed to be the best lead I had. Good luck, and if you figure it out, please post how you did it so others will know.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2000
    Location
    Québec, Canada
    Posts
    212
    Ok thanks,

    I didn't had time to create my own class so I went with Datagrid Editcolumn instead of doing mass update, I do each item with Edit/Udate.

    Thanks for everything!
    Regards,

    El-Nino

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width