I think you have to assign the value in init in code behind, before page load.
If I remember correct, the webform elements load first, and then page.load fires in the page life cycle
My mistake about the master page holding its own view state which is not shared. But I am correct about loaing the viewstate in page.init to hold its value during partial page post backs, and not page load
Hi, I am trying to insert some date to my SQL-Server using ASP.Net. But I am getting the error message like, " ExecuteNonQuery: Connection property has not been initialized." I am using store procedure to store the date. My code is
when you are binding the valuesfromany source, create another alias in your selection query.
ex: select fullname,left(fullname,20) as shortname from tablename
the 20 mentioned can be of your need.andthen bind the shortname to literal.it works.
<ItemTemplate><asp:CheckBoxID="chkItemSelect"runat="server"/><asp:LabelID="lblname"Text='<%#Bind("name")%>'runat="server"/><asp:ButtonID="btnFindx"runat="server"CommandName="Findx"Text="Do Some thing"CommandArgument='<%#Eval("ID")%>'></asp:Button></ItemTemplate>
So, in event OnRowCommand(Code Behind) :
Protected Sub GridView_RowCommand(sender As [Object], e As GridViewCommandEventArgs)
Select Case e.CommandName
..in MethodFindControlValue() :
Private Sub MethodFindControlValue()
For Each row As GridViewRow In ApprovalGrid.Rows
Dim chkItemSelect As CheckBox = CType(row.FindControl("chkItemSelect"), CheckBox)
Dim chkItemSelect As Label = CType(row.FindControl("lblname"), CheckBox)
Dim id As String = Convert.ToString(NameGridView.DataKeys(row.RowIndex).Value.ToString())