我是asp.net 的新手。我正在做一个项目。因为我使用了一个 gridview 并使用 sqldatasource 从数据库中获取数据。网格视图代码是
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="Library" CellPadding="4" ForeColor="#333333"
GridLines="None" OnRowDataBound="GridView1_RowDataBound" >
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="Sl_No" HeaderText="Sl_No" SortExpression="Sl_No" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="Author" HeaderText="Author"
SortExpression="Author" />
<asp:BoundField DataField="Publication" HeaderText="Publication"
SortExpression="Publication" />
<asp:BoundField DataField="Available" HeaderText="Status"
SortExpression="Available" />
<asp:TemplateField HeaderText="Availability">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Available") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RIUserTaken" HeaderText="RIUserTaken"
SortExpression="RIUserTaken" Visible="False" />
<asp:TemplateField HeaderText="Taken By" ShowHeader="False">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Eval("RIUserTaken", "{0}") %>'></asp:Label>
<asp:Button ID="SendRequest" runat="server" Text="Button" Visible="False"
onclick="SendRequest_Click" CommandName="SendRequestCmd" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Taken Date" InsertVisible="False"
ShowHeader="False">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("TakenDate") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" /> </asp:GridView>
代码是网格视图的列之一。如果我单击该按钮,我必须将该按钮存储在字符串变量中包含所有数据的行。像字符串 slno=""; slno=gridview1.cells[0].text; (我不确定它是否正确)请有人帮助我吗?
提前致谢 :)