I have a page with many controls. Among these controls there is a table
which is a datagrid with nested repeater inside. My problem is that I can
not use DataGridCommand EventArgs to get datagrid elements because submit
button is not in datagrid and uses onClick event btnSaveServiceP lanUpdate.
Here is the code:
Sub btnSaveServiceP lanUpdate_OnCli ck(sender As Object, e As EventArgs)
' need to get the key value serviceplanprog ram_id and other elements of
datagrid here
.....
Response.Write( "<br>Progra m id: " & intProgramID)
Response.Write( "<br>Notes: " & Request.Form("t xtNotes"))
.....
End Sub
<asp:table id="tClientNote " runat="server" CellPadding="3" CellSpacing="0" >
<asp:tablerow runat="server">
<asp:tablecel l runat="server">
.....
<asp:tablerow runat="server">
<asp:tablecel l runat="server"> Notes</asp:tablecell>
<asp:tablecel l runat="server"> <ASP:TextBox id="txtNotes" runat="server"
Text="" TextMode="Multi line" Columns="40" Rows="4" /></asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecel l runat="server"> Added By</asp:tablecell>
<asp:tablecel l runat="server"> <asp:label id="lblAdded_by " Text=""
runat="server" /></asp:tablecell>
</asp:tablerow>
....
<asp:tablerow runat="server">
<asp:tablecel l columnspan="2" runat="server">
<ASP:DataGrid id="dgrdCurrent ServicePlanProg rams" RunAt="Server"
Width="800" BorderWidth="0" CellPadding="3" CellSpacing="0"
HeaderStyle-BackColor="#F6F 6F6"
AlternatingItem Style-BackColor="Alic eBlue"
AutoGenerateCol umns="False" DataKeyField="s erviceplanprogr am_id"
AllowPaging="Fa lse"
OnItemCommand=" Grid_CurrentSer vicePlanProgram Command"
<ItemStyle VerticalAlign=" top" />
<Columns>
<asp:BoundColum n Visible="False" HeaderText=""
DataField="serv iceplanprogram_ id" />
<asp:BoundColum n HeaderText="Pro gram" DataField="prog ram_name" />
<asp:TemplateCo lumn HeaderText="Not es">
<ItemTemplate >
<ASP:TextBox id="txtActivity Notes" runat="server" Text=""
TextMode="Multi line" columns="15" rows="3" />
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn ItemStyle-Width="20%" HeaderText="Cur rent
progress toward goals<br />(1 lowest, 3 highest)">
<ItemTemplate >
<asp:dropdownli st id="ddlCurrent_ progress" CssClass="requi red"
runat="server">
<asp:listitem text="(unspecif ied)" value="-1" runat="server" />
<asp:listitem text="1" value="1" runat="server" />
<asp:listitem text="2" value="2" runat="server" />
<asp:listitem text="3" value="3" runat="server" />
</asp:dropdownlis t>
</ItemTemplate>
</asp:TemplateCol umn>
<asp:TemplateCo lumn HeaderText="Com ments">
<ItemTemplate >
<ASP:Repeater id="rptActiviti es"
DataSource='<%# GetActivities( Container.DataI tem("program_id ") )
%>'
runat="server">
<ItemTemplate >
<table border="0">
<tr>
<td width="70%">
<ASP:CheckBox id="chkActivity ID" Value='<%#
Container.DataI tem("activity_i d") %>' runat="server" Text='<%#
Container.DataI tem("name") %>' />
</td>
<td width="30%">
<ASP:TextBox id="txtActivity _other" visible='<%#
ShowOther(Conta iner.DataItem(" is_allow_additi onal_text")) %>'
maxlenght="100" runat="server" columnspan="10" />
</td>
</table>
</ItemTemplate>
</ASP:Repeater>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</ASP:DataGrid>
</asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecel l columnspan="2" runat="server" HorizontalAlign ="center"
runat="server">
<asp:button id="btnSaveServ icePlanUpdate" Text="Save" Visible="true"
runat="server" CommandName="sa veupdate"
OnClick="btnSav eServicePlanUpd ate_OnClick" />
</asp:tablecell>
</asp:tablerow>
.....
Thanks