日期:2014-05-17 浏览次数:20817 次
<asp:TemplateField HeaderText="订货途径"> <ItemTemplate> <asp:DropDownList ID="DropDownList1" runat="server" > </asp:DropDownList> </ItemTemplate> </asp:TemplateField>
sqloldArrival.Connection = srcConnection; sqloldArrival.CommandText = "select DHWays 订货途径 from xxx Where SheetID='" + sheetid + "' "; sqloldArrival.CommandType = CommandType.Text; daoldArrival.SelectCommand = sqloldArrival; daoldArrival.Fill(dtoldArrival); GvArrivalDetail.DataSource = dtoldArrival; GvArrivalDetail.DataBind(); for (int i = 0; i < GvArrivalDetail.Rows.Count; i++) { DropDownList ddl = (DropDownList)GvArrivalDetail.Rows[i].Cells[10].FindControl("DropDownList1"); ddl.Enabled = false;//将ddl的状态设为禁用 }
if (((DropDownList)e.Row.FindControl("DropDownList1")) != null) { DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1"); ddl.Items.Clear(); ddl.Items.Insert(0, new ListItem("画册", "0")); ddl.Items.Insert(1, new ListItem("样品", "1")); ddl.Items.Insert(2, new ListItem("其他", "2")); }