日期:2014-05-17 浏览次数:20416 次
<EditItemTemplate> <asp:DropDownList ID="ddlPianqu" runat="server" AutoPostBack="true" DataSource='<%# ddlbind()%>' DataValueField="id" DataTextField="pianqu"></asp:DropDownList> <asp:Label ID="lblPianqu" Text='<%# Bind("pianquid") %>' Visible="false" runat="server"></asp:Label> </EditItemTemplate>
protected void GridView1_ItemUpdating(Object sender, GridViewUpdateEventArgs e) { ControlParameter cp_id = new ControlParameter("id", TypeCode.String, GridView1.Rows[GridView1.EditIndex].FindControl("lblId").UniqueID.ToString(), "Text"); ControlParameter cp_salesman = new ControlParameter("salesman", TypeCode.String, GridView1.Rows[GridView1.EditIndex].FindControl("salesmanTextBox").UniqueID.ToString(), "Text"); ControlParameter cp_pianquid = new ControlParameter("pianquid", TypeCode.String, GridView1.Rows[GridView1.EditIndex].FindControl("ddlPianqu").UniqueID.ToString(),"SelectedValue"); SqlDataSource1.UpdateParameters.Add(cp_id); SqlDataSource1.UpdateParameters.Add(cp_salesman); SqlDataSource1.UpdateParameters.Add(cp_pianquid); }