| |||||||||||||||||||
I need to show value in this textbox which is editable
if any one help me best regurds. thanks
Width="470px">
code------
protected void Button2_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('PR no can not be blank');", true);
}
else
{
string unit = "", prno = ""; int qty = 0, accsl = 0; string remark = ""; decimal price = 0;
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
GridViewRow row = GridView1.Rows[i];
CheckBox Chbox = (CheckBox)row.FindControl("chb1");
if (Chbox.Checked == true)
{
select++;
}
}
if (select == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('select checkbox for insert)');", true);
return;
}
for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
{
GridViewRow row = GridView1.Rows[i];
CheckBox Chbox = (CheckBox)row.FindControl("chb1");
if (Chbox.Checked == true)
{
for (int j = 1; j < GridView1.Rows[i].Cells.Count; j++)
{
prno = TextBox1.Text;
//accsl = int.Parse(Label2.Text);
if (j == 1) qty = Convert.ToInt32(GridView1.Rows[i].Cells[j].Text);
if (j == 2) price = Convert.ToDecimal(GridView1.Rows[i].Cells[j].Text);
if (j == 3) unit = GridView1.Rows[i].Cells[j].Text;
if (j == 4) remark = GridView1.Rows[i].Cells[j].Text;
if (j == 5) accsl = Convert.ToInt32(GridView1.Rows[i].Cells[j].Text);
}
InsertData(prno, qty,price, unit, remark, accsl);
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Success fully added (PR...)');", true);
}
}
TextBox1.Enabled = true;
Button2.Visible = false;
}
}

Vishal GilbilePosted Mar 7, 2013, 4:32 AM
This thing can be simply done while creating a template for a gridview by setting its (textBox which is under EditItemTemplate) DataField property to the column of your database whose value needs to be displayed.
With Regards,
Vishal Gilbile.