continous serial number for two grid views
i have three grid view and i need a serial number to be generated to three grid view but i getting serial numer from 0 to 10 to my grid insted 0 to 30
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit GuptaPosted Apr 14, 2017, 3:49 AM
prabha haranPosted Apr 14, 2017, 3:26 AM
prabha haranPosted Apr 14, 2017, 3:24 AM
{
DataSet dp1 = da.GetDataSet("select OfferQuantity,FirstSINo from Tbl_OrderForm where ReportId ='" + ddlorderno.SelectedValue + "'");
var offquantity = dp1.Tables[0].Rows[0][0].ToString();
var firstsno = dp1.Tables[0].Rows[0][1].ToString();
incno = Convert.ToInt32(firstsno);
offqty = Convert.ToInt32(offquantity);
if (TextBox1.Text != string.Empty)
{
double getGridNo = Convert.ToInt32(offquantity);
double getGridTimes =Math.Round(getGridNo / 10);
for (int i = 0; i
CreateDatagrid("txtDynamic" + i);
pnl1.Controls.Add(new LiteralControl("
"));
}
}
}
private void CreateDatagrid(string id)
{
DataGrid txt = new DataGrid();
txt.ID = id;
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("Country",typeof(string)) });
for (int i = incno; i < 15; i++)
{
dt.Columns.Add(i.ToString(), typeof(string));
}
dt.Rows.Add(1, "John ", "United States","1"," ","1"," ","1"," ","1"," ","1"," ");
dt.Rows.Add(2, "Mudassar", "India","1"," ","1"," ","1"," ","1"," ","1","" );
dt.Rows.Add(3, "Mathews", "France","1"," ","1"," ","1"," ","1"," ","1","" );
dt.Rows.Add(4, "Robert", "Russia","1"," ","1"," ","1"," ","1"," ","1"," ");
pnl1.Controls.Add(txt);
txt.Visible = true;
txt.Style["height"] = "200px";
txt.Style["width"] = "800px";
txt.ForeColor = System.Drawing.Color.Black;
txt.DataSource = dt;
txt.DataBind();
DataGrid dgv=pnl1.FindControl(id) as DataGrid;
dgv.AutoGenerateColumns = false;
}
}
Amit GuptaPosted Apr 14, 2017, 3:22 AM