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及其類型添加到上面的代碼中,或者非常接近它並獲得你所需要的。如果你需要特定的代碼,如果你需要那麼多的幫助,我可以寫給你。 –