在aspx頁中獲取DataGrid行序號
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" "/>
<Columns>
<asp:BoundColumn HeaderText="序號" DataField="PR_NO_Line"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="單位">
<ItemTemplate>
<asp:TextBox ID="Pcs" Text="PCS" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="Pcs"
ErrorMessage='<%# String.Format("第{0}列物品計量單位",Convert.ToInt32(DataBinder.Eval(Container,"ItemIndex"))+1) %>' ForeColor="red"
ValidationGroup="vs">*</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateColumn>
<%-- <asp:TemplateColumn HeaderText="交貨日期">
<ItemTemplate>
<esshs:InputCalendar ID="InputCalendar1" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
--%> </Columns>
</asp:DataGrid>
<Columns>
<asp:BoundColumn HeaderText="序號" DataField="PR_NO_Line"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="單位">
<ItemTemplate>
<asp:TextBox ID="Pcs" Text="PCS" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="Pcs"
ErrorMessage='<%# String.Format("第{0}列物品計量單位",Convert.ToInt32(DataBinder.Eval(Container,"ItemIndex"))+1) %>' ForeColor="red"
ValidationGroup="vs">*</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateColumn>
<%-- <asp:TemplateColumn HeaderText="交貨日期">
<ItemTemplate>
<esshs:InputCalendar ID="InputCalendar1" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
--%> </Columns>
</asp:DataGrid>