|
The findcontrol event is not getting the control e.g. "btnSubmit" placed inside a gridview itemtemplate tag.
please help with code in VB.NET
|
|
|
|
|
<ItemTemplate>
<asp:CheckBox ID="chkItemSelect" runat="server" />
<asp:Label ID="lblname" Text='<%#Bind("name")%>' runat="server" />
<asp:Button ID="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
Case "Findx"
MethodFindControlValue()
Exit Select
End Select
End Sub
..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())
Next
End Sub
hope this help you............
|
|
|
|
|
paste the code what you have done till now?..so that we can help you in correcting the errors.
|
|
|
|
|
Thanks for the help dear!
but my case was solved as I used the LINK BUTTON instead of button in the itemtemplate tag of Gridview
|
|
|
|
|
ok...sure...enjoy coding...all the best..
|
|
|
|