Gridview inserting textbox
what is this error plz explain




Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 29, 2013, 11:02 PM EDT
plz share your aspx.
Safeer Safeer171 reputationPosted Aug 30, 2013, 7:21 PM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
.cs
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Rows.Add();
gvname.DataSource = dt;
gvname.DataBind();
}
}
protected void btnsave_Click(object sender, EventArgs e)
{
sp ps = new sp();
info nameinfo = new info();
foreach (GridViewRow row in gvname.Rows)
{
TextBox txtname = ((TextBox)row.FindControl("txtname"));
TextBox txtplace = ((TextBox)row.FindControl("txtplace"));
nameinfo.Name=txtname.Text;
nameinfo.place=txtplace.Text;
ps.NameAdd(nameinfo);
}
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
}
}
Safeer Safeer171 reputationPosted Aug 30, 2013, 7:22 PM EDT
Safeer Safeer171 reputationPosted Aug 30, 2013, 7:27 PM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 30, 2013, 8:28 PM EDT
What is the work of insert button as you are storing the data in database on save button click.
plz provide clear details.
Safeer Safeer171 reputationPosted Aug 30, 2013, 8:34 PM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 30, 2013, 9:05 PM EDT
refer to this link.
http://www.aspsnippets.com/Articles/Add-new-Row-to-GridView-on-Button-Click-in-ASPNet.aspx