473,473 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Inserting a row in Gridview

375 Contributor
Hi
I want to insert a new row in a gridview using C# and asp.net 2005.
i have created buttons for edit and delete. now i want to have a button which is called as insert.

so far i have done the below by going through various sites including ours
Created a new imagebutton in the grid named it as insert
I have 6 fields hence went to each of its footer and dropped a textbox in each of the footer template.

Now what??????????
help please

thanks
cmrhema
Aug 6 '07 #1
4 1433
radcaesar
759 Recognized Expert Contributor
if (e.CommandName == "Insert")
{

//handle insert here

TextBox tbInsert = GridView1.FooterRow.FindControl("tbInsert") as TextBox;

Label1.Text = string.Format("You would have inserted the name : <b>{0}</b> from the footerrow", tbInsert.Text);

}

Refer this post for further clarifications,

http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspx
Aug 6 '07 #2
cmrhema
375 Contributor
Thanks Radcaesar for the reply.
Actually i am struggling at the very begining. Let me be very precise
I have 6 fields in my table and i have added two image buttons for edit and delete events.
I have converted all of the above(6 fields+2(1 for edit,1 for delete))=8 fields to template fields.
Now on each of the 6 templatefields(databse fields which i converted to template) I have inserted a textbox on the footer.
Also on the footer template of the edit field i have created an imagebutton for delete field.

Now my first problem. When I run the program i do not see the fields present in the footer nor the deletebutton which i placed in the footer of the edit field.

Where does my problem lie.?

thanks for the previous reply.

if (e.CommandName == "Insert")
{

//handle insert here

TextBox tbInsert = GridView1.FooterRow.FindControl("tbInsert") as TextBox;

Label1.Text = string.Format("You would have inserted the name : <b>{0}</b> from the footerrow", tbInsert.Text);

}

Refer this post for further clarifications,

http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspx
Aug 6 '07 #3
radcaesar
759 Recognized Expert Contributor
Hi,
You better refer this and get back if u have any issues.

http://forums.asp.net/p/1085421/1614832.aspx

Have to enable footer in the Gridview ? Else the footer will not be seen.
Aug 6 '07 #4
cmrhema
375 Contributor
Hi,
You better refer this and get back if u have any issues.

http://forums.asp.net/p/1085421/1614832.aspx

Have to enable footer in the Gridview ? Else the footer will not be seen.
Its still the same.
When i include the buttons or textboxes in the footer template, it is visible below the grid.
it is not included in the grid.
all these are placed below the grid.
Thanks
Aug 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: brett | last post by:
I'm using a GridView for selects and edits. I'd like to keep this view and have an Insert option. I don't want a detailsview because you have to see an editing view first. I want to start on the...
3
by: rcoco | last post by:
Hi, I want to share this problem. I have a datagrid that will help me Insert data into sql database. So I made a button On my form so that when I press the button a new row on datagrid should be...
0
by: takallen | last post by:
Hello, I am designing a web page that is to be used as a data entry form. Each row on the page contains 50 columns, and the user needs to be able to input about 25 rows on each page. To...
0
by: rajesh0303 | last post by:
Iam get null values in the datakeynames AlertID,ItemID while executing the Insert Command....I am Inserting using Externel button Event.Here is the code of Gridiew ,Its datasource and the button...
21
tsubasa
by: tsubasa | last post by:
I am working on a wish list where users add products to their list for future purhcases. I am using a GridView to display the records by users after they have login to the shopping cart. How can I...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.