62,074
社区成员
发帖
与我相关
我的任务
分享
<asp:TemplateField HeaderText="楼栋">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" Width="50px" ReadOnly="True" BackColor="LightGray">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
this.GetB_Code(DropDownList1); //建立查下拉框的内容
for(i=0;i<GridView1.Rows.Count;i++)
{
this.DropDownList1.SelectedValue = GridView1.Rows[i]["b_code"].ToString().Trim(); //下拉框设默认值
}
<asp:TemplateField HeaderText="楼栋">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" Width="50px" ReadOnly="True" BackColor="LightGray">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
for(i=0;i<GridView1.Rows.Count;i++)
{
DropDownList DropDownList1= (DropDownList)GridView1.Rows[i].FindControl("DropDownList1");
this.GetB_Code(DropDownList1);
DropDownList1.SelectedValue = GridView1.Rows[i].Cells[8].Text.Trim();
}