问:
要获得MAmount的值如何获得
<asp:TemplateField HeaderText="数量" SortExPRession="MAmount" HeaderStyle-Width="150">
<ItemTemplate>
<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 = "atualizar yf_Purchases set Main=@Main , MAmount=@MAmount,MOverDate=@MOverDate,MMPrice=@MMPrice where 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")).Text;
cmd.Parameters["@MAmount"].Valor =?
答:
Exemplo:
void protegido GridView1_RowDataBound (remetente do objeto, GridViewRowEventArgs e)
{
tentar
{
if (e.Row.Cells[12].Text.ToString() == "提交待审核" || e.Row.Cells[12].Text.ToString() == "审核通过")
{
Rótulo lbl_edit = e.Row.FindControl("Label1_edit") como Rótulo;
Rótulo lbl_editr = e.Row.FindControl("Label1_editr") como Rótulo;
lbl_edit.Visible = falso;
lbl_editr.Text = " ";
lbl_editr.Visible = verdadeiro;
}
}
pegar { }
}