问:
要获得MAmount的值如何获得
<asp:TemplateField HeaderText="数量" SortExPRession="MAmount" HeaderStyle-Width="150">
<Plantilla de artículo>
<my:SelectNumber ID="MAmount" runat="server" Value='<%#Bind("MAmount") %>' />
</ItemTemplate>
</asp:TemplateField>
问题补充:要将GridView中的数据批量修改,用FindControl获得<my:SelectNumber ID="MAmount" runat="server" Value='<%#Bind("MAmount") %>' />的值
cmd.CommandType = CommandType.Text;
cmd.CommandText = "actualizar yf_Purchases set Main=@Main , MAmount=@MAmount,MOverDate=@MOverDate,MMPrice=@MMPrice donde OrderID=@OrderID ";
cmd.Parameters.Add("@OrderId", SqlDbType.NVarChar, 20);
cmd.Parameters.Add("@Main", SqlDbType.NVarChar, 10);
cmd.Parameters.Add("@MAmount", SqlDbType.Int);
cmd.Parameters.Add("@MOverDate", SqlDbType.VarChar,50);
cmd.Parameters.Add("@MMPrice", SqlDbType.Int);
cmd.Parameters["@OrderId"].Value = ((HiddenField)gvr.FindControl("OrderID")).Value;
cmd.Parameters["@Main"].Value = ((TextBox)gvr.FindControl("Main")).Texto;
cmd.Parameters["@MAmount"].Valor =?
答:
Ejemplo:
vacío protegido GridView1_RowDataBound (remitente del objeto, GridViewRowEventArgs e)
{
intentar
{
if (e.Row.Cells[12].Text.ToString() == "提交待审核" || e.Row.Cells[12].Text.ToString() == "审核通过")
{
Etiqueta lbl_edit = e.Row.FindControl("Label1_edit") como etiqueta;
Etiqueta lbl_editr = e.Row.FindControl("Label1_editr") como etiqueta;
lbl_edit.Visible = falso;
lbl_editr.Text = " ";
lbl_editr.Visible = verdadero;
}
}
atrapar { }
}