N
News
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 DataGridCommandEventArgs to get datagrid elements because submit
button is not in datagrid and uses onClick event btnSaveServicePlanUpdate.
Here is the code:
Sub btnSaveServicePlanUpdate_OnClick(sender As Object, e As EventArgs)
' need to get the key value serviceplanprogram_id and other elements of
datagrid here
.....
Response.Write("<br>Program id: " & intProgramID)
Response.Write("<br>Notes: " & Request.Form("txtNotes"))
.....
End Sub
<asp:table id="tClientNote" runat="server" CellPadding="3" CellSpacing="0">
<asp:tablerow runat="server">
<asp:tablecell runat="server">
.....
<asp:tablerow runat="server">
<asp:tablecell runat="server">Notes</asp:tablecell>
<asp:tablecell runat="server"><ASP:TextBox id="txtNotes" runat="server"
Text="" TextMode="Multiline" Columns="40" Rows="4" /></asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecell runat="server">Added By</asp:tablecell>
<asp:tablecell runat="server"><asp:label id="lblAdded_by" Text=""
runat="server" /></asp:tablecell>
</asp:tablerow>
....
<asp:tablerow runat="server">
<asp:tablecell columnspan="2" runat="server">
<ASPataGrid id="dgrdCurrentServicePlanPrograms" RunAt="Server"
Width="800" BorderWidth="0" CellPadding="3" CellSpacing="0"
HeaderStyle-BackColor="#F6F6F6"
AlternatingItemStyle-BackColor="AliceBlue"
AutoGenerateColumns="False" DataKeyField="serviceplanprogram_id"
AllowPaging="False"
OnItemCommand="Grid_CurrentServicePlanProgramCommand"<ItemStyle VerticalAlign="top" />
<Columns>
<asp:BoundColumn Visible="False" HeaderText=""
DataField="serviceplanprogram_id" />
<asp:BoundColumn HeaderText="Program" DataField="program_name" />
<asp:TemplateColumn HeaderText="Notes">
<ItemTemplate>
<ASP:TextBox id="txtActivityNotes" runat="server" Text=""
TextMode="Multiline" columns="15" rows="3" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="20%" HeaderText="Current
progress toward goals<br />(1 lowest, 3 highest)">
<ItemTemplate>
<asp:dropdownlist id="ddlCurrent_progress" CssClass="required"
runat="server">
<asp:listitem text="(unspecified)" 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:dropdownlist>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Comments">
<ItemTemplate>
<ASP:Repeater id="rptActivities"
DataSource='<%# GetActivities( Container.DataItem("program_id") )
%>'
runat="server">
<ItemTemplate>
<table border="0">
<tr>
<td width="70%">
<ASP:CheckBox id="chkActivityID" Value='<%#
Container.DataItem("activity_id") %>' runat="server" Text='<%#
Container.DataItem("name") %>' />
</td>
<td width="30%">
<ASP:TextBox id="txtActivity_other" visible='<%#
ShowOther(Container.DataItem("is_allow_additional_text")) %>'
maxlenght="100" runat="server" columnspan="10" />
</td>
</table>
</ItemTemplate>
</ASP:Repeater>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</ASPataGrid>
</asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecell columnspan="2" runat="server" HorizontalAlign="center"
runat="server">
<asp:button id="btnSaveServicePlanUpdate" Text="Save" Visible="true"
runat="server" CommandName="saveupdate"
OnClick="btnSaveServicePlanUpdate_OnClick" />
</asp:tablecell>
</asp:tablerow>
.....
Thanks
which is a datagrid with nested repeater inside. My problem is that I can
not use DataGridCommandEventArgs to get datagrid elements because submit
button is not in datagrid and uses onClick event btnSaveServicePlanUpdate.
Here is the code:
Sub btnSaveServicePlanUpdate_OnClick(sender As Object, e As EventArgs)
' need to get the key value serviceplanprogram_id and other elements of
datagrid here
.....
Response.Write("<br>Program id: " & intProgramID)
Response.Write("<br>Notes: " & Request.Form("txtNotes"))
.....
End Sub
<asp:table id="tClientNote" runat="server" CellPadding="3" CellSpacing="0">
<asp:tablerow runat="server">
<asp:tablecell runat="server">
.....
<asp:tablerow runat="server">
<asp:tablecell runat="server">Notes</asp:tablecell>
<asp:tablecell runat="server"><ASP:TextBox id="txtNotes" runat="server"
Text="" TextMode="Multiline" Columns="40" Rows="4" /></asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecell runat="server">Added By</asp:tablecell>
<asp:tablecell runat="server"><asp:label id="lblAdded_by" Text=""
runat="server" /></asp:tablecell>
</asp:tablerow>
....
<asp:tablerow runat="server">
<asp:tablecell columnspan="2" runat="server">
<ASPataGrid id="dgrdCurrentServicePlanPrograms" RunAt="Server"
Width="800" BorderWidth="0" CellPadding="3" CellSpacing="0"
HeaderStyle-BackColor="#F6F6F6"
AlternatingItemStyle-BackColor="AliceBlue"
AutoGenerateColumns="False" DataKeyField="serviceplanprogram_id"
AllowPaging="False"
OnItemCommand="Grid_CurrentServicePlanProgramCommand"<ItemStyle VerticalAlign="top" />
<Columns>
<asp:BoundColumn Visible="False" HeaderText=""
DataField="serviceplanprogram_id" />
<asp:BoundColumn HeaderText="Program" DataField="program_name" />
<asp:TemplateColumn HeaderText="Notes">
<ItemTemplate>
<ASP:TextBox id="txtActivityNotes" runat="server" Text=""
TextMode="Multiline" columns="15" rows="3" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn ItemStyle-Width="20%" HeaderText="Current
progress toward goals<br />(1 lowest, 3 highest)">
<ItemTemplate>
<asp:dropdownlist id="ddlCurrent_progress" CssClass="required"
runat="server">
<asp:listitem text="(unspecified)" 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:dropdownlist>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Comments">
<ItemTemplate>
<ASP:Repeater id="rptActivities"
DataSource='<%# GetActivities( Container.DataItem("program_id") )
%>'
runat="server">
<ItemTemplate>
<table border="0">
<tr>
<td width="70%">
<ASP:CheckBox id="chkActivityID" Value='<%#
Container.DataItem("activity_id") %>' runat="server" Text='<%#
Container.DataItem("name") %>' />
</td>
<td width="30%">
<ASP:TextBox id="txtActivity_other" visible='<%#
ShowOther(Container.DataItem("is_allow_additional_text")) %>'
maxlenght="100" runat="server" columnspan="10" />
</td>
</table>
</ItemTemplate>
</ASP:Repeater>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</ASPataGrid>
</asp:tablecell>
</asp:tablerow>
<asp:tablerow runat="server">
<asp:tablecell columnspan="2" runat="server" HorizontalAlign="center"
runat="server">
<asp:button id="btnSaveServicePlanUpdate" Text="Save" Visible="true"
runat="server" CommandName="saveupdate"
OnClick="btnSaveServicePlanUpdate_OnClick" />
</asp:tablecell>
</asp:tablerow>
.....
Thanks