主题:[原创]求助: 关于GRIDVIEW取值
补充信息:
问题是: 想取出gridview中嵌套的edititemtemplate中的值,每行都取出来,
每行6个, 分别是 計画1 計画2。。到 計画6, 怎么办呢?
帮忙啊 !
以下是 計画1 列的代码。
<asp:TemplateField HeaderText="計画1">
<edititemtemplate>
<asp:TextBox id="txt計画1" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>' id="lbl計画1" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
以下是GridViewBE全部代码:
<WebCustom:GridViewBE ID="gbe計画入力SR" runat="server" AutoGenerateColumns="False" BeEnbaleBulkEdit="False" DataSourceID="sds計画入力SR" AllowPaging="True" EnableViewState="False" FxColsLeftNumber="8" PageSize="3" DataKeyNames="データ年期,品目コード,卸管理支店コード,契約先コード" OnPageIndexChanging="gbe計画入力SR_PageIndexChanging" OnRowCreated="gbe計画入力SR_RowCreated" OnSelectedIndexChanged="gbe計画入力SR_SelectedIndexChanged" OnRowUpdating="gbe計画入力SR_RowUpdating" OnRowUpdated="gbe計画入力SR_RowUpdated" BorderColor="Gray" FxEnableFixedHeader="False" >
<Columns>
<asp:BoundField DataField="計画年" HeaderText="計画年" SortExpression="計画年" ReadOnly="True" >
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="半期" HeaderText="半<BR>期" SortExpression="半期" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="支店コード" HeaderText="支店<BR>コード" SortExpression="支店コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="契約先コード" HeaderText="契約先<BR>コード" SortExpression="契約先コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="契約先名" HeaderText="契約先名" SortExpression="契約先名" ReadOnly="True" >
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="品目コード" HeaderText="品目<BR>コード" SortExpression="品目コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="納入計画金額1" HeaderText="TOTALの計画<BR>納入計画<BR>金額1" SortExpression="納入計画金額1" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="納入計画金額2" HeaderText="Pの計画<BR>納入計画<BR>金額2" SortExpression="納入計画金額2" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:TemplateField HeaderText="計画1">
<edititemtemplate>
<asp:TextBox id="txt計画1" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>' id="lbl計画1" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画2">
<edititemtemplate>
<asp:TextBox id="txt計画2" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率2","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率2","{0:#,##0}") %>' id="lbl計画2" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画3">
<edititemtemplate>
<asp:TextBox id="txt計画3" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率3","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率3","{0:#,##0}") %>' id="lbl計画3" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画4">
<edititemtemplate>
<asp:TextBox id="txt計画4" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率4","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率4","{0:#,##0}") %>' id="lbl計画4" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画5">
<edititemtemplate>
<asp:TextBox id="txt計画5" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率5","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left" />
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率5","{0:#,##0}") %>' id="lbl計画5" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画6">
<edititemtemplate>
<asp:TextBox id="txt計画6" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率6","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率6","{0:#,##0}") %>' id="lbl計画6" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="更新者ID" HeaderText="更新者<BR>ID" ReadOnly="True" SortExpression="更新者ID" HtmlEncode="False" >
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="更新日時" HeaderText="更新日時" ReadOnly="True" SortExpression="更新日時" DataFormatString="{0:yyyy/MM/dd HH:mm}" HtmlEncode="False" >
<headerstyle />
</asp:BoundField>
</Columns>
<PagerSettings Mode="NumericFirstLast" />
</WebCustom:GridViewBE>
问题是: 想取出gridview中嵌套的edititemtemplate中的值,每行都取出来,
每行6个, 分别是 計画1 計画2。。到 計画6, 怎么办呢?
帮忙啊 !
以下是 計画1 列的代码。
<asp:TemplateField HeaderText="計画1">
<edititemtemplate>
<asp:TextBox id="txt計画1" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>' id="lbl計画1" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
以下是GridViewBE全部代码:
<WebCustom:GridViewBE ID="gbe計画入力SR" runat="server" AutoGenerateColumns="False" BeEnbaleBulkEdit="False" DataSourceID="sds計画入力SR" AllowPaging="True" EnableViewState="False" FxColsLeftNumber="8" PageSize="3" DataKeyNames="データ年期,品目コード,卸管理支店コード,契約先コード" OnPageIndexChanging="gbe計画入力SR_PageIndexChanging" OnRowCreated="gbe計画入力SR_RowCreated" OnSelectedIndexChanged="gbe計画入力SR_SelectedIndexChanged" OnRowUpdating="gbe計画入力SR_RowUpdating" OnRowUpdated="gbe計画入力SR_RowUpdated" BorderColor="Gray" FxEnableFixedHeader="False" >
<Columns>
<asp:BoundField DataField="計画年" HeaderText="計画年" SortExpression="計画年" ReadOnly="True" >
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="半期" HeaderText="半<BR>期" SortExpression="半期" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="支店コード" HeaderText="支店<BR>コード" SortExpression="支店コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="契約先コード" HeaderText="契約先<BR>コード" SortExpression="契約先コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="契約先名" HeaderText="契約先名" SortExpression="契約先名" ReadOnly="True" >
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="品目コード" HeaderText="品目<BR>コード" SortExpression="品目コード" ReadOnly="True" HtmlEncode="False">
<itemstyle />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="納入計画金額1" HeaderText="TOTALの計画<BR>納入計画<BR>金額1" SortExpression="納入計画金額1" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="納入計画金額2" HeaderText="Pの計画<BR>納入計画<BR>金額2" SortExpression="納入計画金額2" ReadOnly="True" HtmlEncode="False">
<itemstyle horizontalalign="Right" />
<headerstyle />
</asp:BoundField>
<asp:TemplateField HeaderText="計画1">
<edititemtemplate>
<asp:TextBox id="txt計画1" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率1","{0:#,##0}") %>' id="lbl計画1" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画2">
<edititemtemplate>
<asp:TextBox id="txt計画2" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率2","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率2","{0:#,##0}") %>' id="lbl計画2" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画3">
<edititemtemplate>
<asp:TextBox id="txt計画3" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率3","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率3","{0:#,##0}") %>' id="lbl計画3" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画4">
<edititemtemplate>
<asp:TextBox id="txt計画4" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率4","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率4","{0:#,##0}") %>' id="lbl計画4" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画5">
<edititemtemplate>
<asp:TextBox id="txt計画5" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率5","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left" />
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率5","{0:#,##0}") %>' id="lbl計画5" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="計画6">
<edititemtemplate>
<asp:TextBox id="txt計画6" width="50px" style="TEXT-ALIGN:right; IME-MODE:disabled;PADDING-BOTTOM:0px;PADDING-TOP:0px;" autocomplete="off" runat="server" Text='<%# Bind("計画比率6","{0:#,##0}") %>'></asp:TextBox>
</edititemtemplate>
<itemstyle horizontalalign="Right"/>
<headerstyle horizontalalign="Left"/>
<itemtemplate>
<asp:Label runat="server" Text='<%# Bind("計画比率6","{0:#,##0}") %>' id="lbl計画6" style="TEXT-ALIGN:right;"></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="更新者ID" HeaderText="更新者<BR>ID" ReadOnly="True" SortExpression="更新者ID" HtmlEncode="False" >
<headerstyle />
</asp:BoundField>
<asp:BoundField DataField="更新日時" HeaderText="更新日時" ReadOnly="True" SortExpression="更新日時" DataFormatString="{0:yyyy/MM/dd HH:mm}" HtmlEncode="False" >
<headerstyle />
</asp:BoundField>
</Columns>
<PagerSettings Mode="NumericFirstLast" />
</WebCustom:GridViewBE>