hello dear i am in problem.
I need to show value in this textbox which is editable
if any one help me best regurds. thanks
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
HeaderStyle-BackColor="Red" HeaderStyle-ForeColor="White" Height="82px"
Width="470px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chb1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="PRSL" HeaderText="PRSL" />
<asp:BoundField DataField="RequiredQty" HeaderText="Qty" />
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtQty" runat="server">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Price" HeaderText="Price" />
<asp:BoundField DataField="Unit" HeaderText="Unit" />
</Columns>
</asp:GridView>
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;
}
}
please give me your solution with codeproject.