You must Sign In to post a response.
  • Category: ASP.NET

    GridView - Dynamically added Itemtemplate control value not fetching

    Hai All,

    May I know any solution for below senario
    I have added itemtemplate controls dynamically. worked fine
    but I entered the value for the control(textbox) in gridview, that value not visible when postback


    Thanks and Regards,
    A.L.Chellappan
  • #761215
    Hi,

    This may be because you have not bind your text box value to some state management methods.

    If you donot have any hidden field,view state or session how will the page or textbox hold back the value between postbacks.

    If it is for the same page postback, i would suggest you to use a viewstate to store the value.

  • #761218
    Hi

    You can go through Below link for dynamic created control fetch the data

    http://www.codeproject.com/Questions/330441/How-to-get-value-of-the-dynamically-created-contro

    http://www.codeproject.com/Questions/150950/Retrieve-ItemTemplate-control-value-in-Gridview-Ro

    http://www.aspsnippets.com/Articles/Add-TemplateField-Column-dynamically-in-GridView-in-ASPNet.aspx


    http://www.binaryintellect.net/articles/0b4f8e1c-39e6-4070-abc0-7a970e7553bc.aspx

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761229
    Hi chellappan,

    Yes, it is happen because of postback after postback values remains zero. You need to maintain state using several state controls available in .net or else better to create template in gridview and based on condition you can show or hide to user.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #761230
    i think you need to add the control in update panel.
    Do Good... Enjoy your life.....


Sign In to post your comments