问:
要获得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 = "update 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"].Value =?
答:
Antwort:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
versuchen
{
if (e.Row.Cells[12].Text.ToString() == "Weitere Informationen" || e.Row.Cells[12].Text.ToString() == "Weitere Informationen")
{
Label lbl_edit = e.Row.FindControl("Label1_edit") as Label;
Label lbl_editr = e.Row.FindControl("Label1_editr") as Label;
lbl_edit.Visible = false;
lbl_editr.Text = " ";
lbl_editr.Visible = true;
}
}
fangen { }
}