.net中gridview

来源:百度知道 编辑:UC知道 时间:2024/05/28 06:22:23
要做一个评测系统,对其各个方面进行评测用DropDownList,然后要求(点击提交)把评测的结果(就是DropDownList值)存到数据库中,是用gridview吗?代码应该怎么写?
首先,非常非常感谢你们的回答
页面代码:
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="fkb_id" HeaderText="序号">
<asp:BoundField DataField="fkb_pjzb" HeaderText="评价指标"/>
<asp:BoundField DataField="fkb_qz" HeaderText="权重"/>
<asp:TemplateField HeaderText="评分标准">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">

protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
DropDownList ddl=(DropDownList)GridView1.Rows[i].FindControl("DropDownList1");
string stardand=ddl..SelectedValue;
....//执行方法
}
}

可能我没理解你的意思,你再说一下

DropDownList
值的获取
int i = DropDownList1.SelectedItem.Value;

string strss="";
strss=DropDownList1.SelectedItem[i].Value;

insert into ss() values(strss)