akhter says:
private
void
SetInitialRow()
{
dt.Columns.Add(
new
DataColumn(
"RowNumber"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"txtcode"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"ddlfourdr"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"txtDebit"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"txtCredit"
,
typeof
(
string
)));
dt.Columns.Add(
new
DataColumn(
"ddltype"
,
typeof
(
string
)));
dr = dt.NewRow();
dr[
"RowNumber"
] = 1;
dr[
"txtcode"
] =
string
.Empty;
dr[
"txtDebit"
] =
string
.Empty;
dr[
"txtCredit"
] =
string
.Empty;
ViewState[
"CurrentTable"
] = dt;
gvtrans.DataSource = dt;
gvtrans.DataBind();
}
Change with below code.
Private void SetInitialRow()
{
dt.Columns.Add(New DataColumn("RowNumber", TypeOf(String)));
dt.Columns.Add(New DataColumn("txtcode", TypeOf(String)));
dt.Columns.Add(New DataColumn("ddlfourdr", TypeOf(String)));
dt.Columns.Add(New DataColumn("txtDebit", TypeOf(String)));
dt.Columns.Add(New DataColumn("txtCredit", TypeOf(String)));
dt.Columns.Add(New DataColumn("ddltype", TypeOf(String)));
dr = dt.NewRow();
dr["RowNumber"] = 1;
dr["txtcode"] = String.Empty;
dr["txtDebit"] = String.Empty;
dr["txtCredit"] = String.Empty;
dt.Rows.Add(dr);
ViewState["CurrentTable"] = dt;
gvtrans.DataSource = dt;
gvtrans.DataBind();
}