0
我想从GridView的单元格的值,但空字符串。我是实施 在单选按钮列表的SelectedIndexChanged事件的所有代码。我的代码。但问题是通过迭代的GridView
和接入小区stll remaining.I使用了三个ItemTemplate中,每个
有一个elemnt使每个元素获得自己的coulmn 的.aspx获取单元格值
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" >
<Columns>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("qno") %>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("description")
%>'>
</ItemTemplate>
</asp:TemplateField>
<asp:RadioButtonList ID="RadioButtonList1" RepeatDirection="Horizontal"
runat="server" OnSelectedIndexChanged="changed" AutoPostBack="true" >
<asp:ListItem Value="agree" Selected="True" >
</asp:ListItem>
<asp:ListItem
Value="disagree">
</asp:ListItem>
<asp:ListItem Value="strongagree">
</asp:ListItem>
<asp:ListItem Value="strondisagree">
</asp:ListItem>
</asp:RadioButtonList>
后面
</Columns>
</asp:GridView>
<asp:Label ID="Labe11" runat="server" ></asp:Label>
代码: 公共无效改变(对象发件人,EventArgs的) {
for(int i=0;i<GridView2.Rows.Count;i++)
{
string labtext;
RadioButtonList list =
GridView2.Rows[i].Cells[2].FindControl("RadioButtonList1") as RadioButtonList;
labtext= GridView2.Rows[i].Cells[0].Text;
Label1.Text = labtext;
}
}
但我想要得到label2的文本 – user1405508
你应该能够将label2及其类型添加到上面的代码中,或者非常接近它并获得你所需要的。如果你需要特定的代码,如果你需要那么多的帮助,我可以写给你。 –