I have a page which has user control in it.
The page data grid bound columns are populated from user control (user control has a data grid whose items are in the form of item templates).
This user control has a column which contains edit save cancel buttons.
The user control also has other columns which are check boxes,drop down lists inside (item templates).
I am using item command event and when Edit link is clicked it should get current row value of a column called "Description" and for testing purpose I am getting this value into a text box called 'Tdval'.
The Tdval textbox is empty and when I check break point it looks like item command event is not all firing( as break point is not hit).
I don't understand why.
The page is not posted back when I click Edit link.
Its just the user control link button. Please help me.
Excuse any mistakes and am new to this. Thanks in advance.
HTML:
<tr>
<asp:datagrid ID="dgDetails"
EnableViewState="true"
runat="server"
onItemCommand="dgDetails_ItemCommand"
allowpaging="false"
allowcustompaging="false"
autogeneratecolumns="false"
allowsorting="true"
backcolor="white"
Width="100%"
horizontalalign="center"
Font-bold="true"
Font-Names="Verdana"
Font-size="7pt"
BorderColor="Silver" >
<columns>
<asp:BoundColumn DataField="ID" Visible="true"></asp:BoundColumn>
<asp:TemplateColumn HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Left"
HeaderText="Description"
HeaderStyle-Width="320px" >
<ItemTemplate>
<asp:Label ID="lblDescription" runat="server">
<%#DataBinder.Eval(Container.DataItem, "Description")%>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderStyle-HorizontalAlign="Left"
ItemStyle-HorizontalAlign="Left"
HeaderText="Pr."
HeaderStyle-Width="20px" >
<ItemTemplate>
<asp:CheckBox ID="chkPrimary" runat="server" Enableviewstate="true">
</asp:CheckBox>
</ItemTemplate>
<asp:LinkButton ID="lnkEdit" runat="server"
CommandName="Edit">Edit
</asp:LinkButton>
</columns>
</asp:datagrid>
</tr>
<tr>
<td>
<asp:TextBox ID="Tdval" runat="server"> </asp:TextBox>
</td>
Code Behind:
Public Sub dgDetails_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDetails.ItemCommand
Select Case e.CommandName
Case "Edit"
Dim intRow As Integer
intRow = e.Item.ItemIndex
Dim dgRow As DataGridItem
dgRow=dgDetails.Items.Item(intRow)
Dim val As String
val=Ctype(dgRow.Cells(0).Text, String) (Description column)
Tdval.Text=val.Text
End Select
End Sub
Page_Load
of the user control, does it hit that break point? – Karl Anderson