ASP.NET get hidden value from list view on ItemCommand -


I have Linkbtn and Hindfild a link sequence I I want to get the hidden value of HiddenField, so I session You can store and transfer a hidden value (stored in session) on a page when a LinkButton is clicked. But I get this error message "The object is not set for an instance of reference object." e.Item

  Protected Sub lvTimeSheet_ItemCommand (ByVal as this object, ByVal e As System.Web.UI.WebControls.ListViewCommandEventArgs) handles lvTimeSheet.ItemCommand dim ID HiddenField = TryCast (: here's function .FindControl ( "hfTimeSheetId"), HiddenField) dim MyID string = id.Value.ToString session ( "MyID") = MyID Server.Transfer ( "Destination.aspx") End Sub  

mark-up

  & lt; / ASP: LinkButton & gt; & Lt; ASP: HiddenField id = "hfTimeSheetId1" runat = "server" value = '& lt;% # Eval ( "hfTimeSheetId")% & gt; '/ & Gt;  

Whenever clicked Linkbtn, then it is an error in the above error message Thanks for any input.

My guess would be that FindControl response not line within hfTimeSheetId Not getting control Did you specify it as a managed control (i.e. runat = "server")?

In addition, if it does, you can help provide ASPX code to see how you are setting control.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -