ドロップダウンリストの選択値に応じて、テキストボックスに値を割り当てたいとします。しかし、私は、これはDataGridviewのコントロールに値を割り当てます。
ここ
「オブジェクト参照がオブジェクトのインスタンスに設定されていません」エラーを取得しようとは、私のコードです:
foreach (GridViewRow gvr in cgvRequest.Rows)
{
//Programmatically access the CheckBox from the TemplateField
//CheckBoxField chk = (CheckBoxField)gvr.FindControl("chkMark");
Label lbl = (Label)gvr.FindControl("lblRequestAmount");
TextBox _txtAmount = (TextBox)cgvRequest.FindControl("txtAmount");
lbl.Text = Convert.ToString(
requestinfo.ElementAt(gvr.RowIndex).AmountRequested);
DropDownList ddl = new DropDownList();
ddl = (DropDownList)cgvRequest.FindControl("ddlApprovalType");
ddl.SelectedValue = "A";
_txtAmount.Text = lbl.Text;
}
どのラインでエラーが表示されますか? – TheBoyan
最後の2行にエラーが表示されます – DawitAB