問:
要獲得MA金額的值如何獲得
<asp:TemplateField HeaderText="數量" SortExPRession="MAmount" HeaderStyle-Width="150">
<專案範本>
<my:SelectNumber ID="MAmount" runat="server" Value='<%#Bind("MAmount") %>' />
</項目模板>
</asp:模板欄位>
問題補充:代表GridView中的資料批次修改,用FindControl取得<my:SelectNumber ID="MAmount" runat="server" Value='<%#Bind("MAmount") %>' />的值
cmd.CommandType = CommandType.Text;
cmd.CommandText =“更新 yf_Purchases 設定Main=@Main , MAmount=@MAmount,MOverDate=@MOverDate,MMPrice=@MMPrice其中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 =?
答:
例子:
protected void GridView1_RowDataBound(物件傳送者,GridViewRowEventArgs e)
{
嘗試
{
if (e.Row.Cells[12].Text.ToString() == "提交待審核" || e.Row.Cells[12].Text.ToString() == "審核通過")
{
標籤 lbl_edit = e.Row.FindControl("Label1_edit") as Label;
標籤 lbl_editr = e.Row.FindControl("Label1_editr") 作為標籤;
lbl_edit.Visible = false;
lbl_editr.Text =“”;
lbl_editr.Visible = true;
}
}
抓住 { }
}