473,856 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert Button. ListView or GridView. Is this possible?

Hello,

I am working with a ListView but I suppose that with a GridView might
be the same.

Instead of having an Insert Button on each GridView row I would like
to have only one Insert button, for example, in the GridView footer.

When this button is clicked it should put the GridView in Insert Mode
and the EditTemplate should be showed, maybe (?), in the last GridView
row.

Do you understand what I mean?

Any idea how to do this?

Thanks,

Miguel
Dec 4 '07 #1
2 10855
On Dec 4, 7:37 pm, shapper <mdmo...@gmail. comwrote:
Hello,

I am working with a ListView but I suppose that with a GridView might
be the same.

Instead of having an Insert Button on each GridView row I would like
to have only one Insert button, for example, in the GridView footer.

When this button is clicked it should put the GridView in Insert Mode
and the EditTemplate should be showed, maybe (?), in the last GridView
row.

Do you understand what I mean?

Any idea how to do this?

Thanks,

Miguel
Please, what I need is something like what you find in the following
ComponentArt Grid:

http://www.componentart.com/webui/de.../WebForm1.aspx

See the button "Add Row" on bottom.
When this button is clicked the Grid goes to Edit mode and the data is
inserted in a new row after the last row.

This is what I need to do.

Any idea?

Thanks,

Miguel
Dec 5 '07 #2
Hello Miguel,

Check out this URL which helped me solve this problem:
http://www.koffeekoder.com/ArticleDetails.aspx?id=139

Basically you just have to edit the footer template for the column
where you want and put a button in it. Then set the CommandName for
the button and in the RowCommand event handler find out if this is the
command that was fired. Here you insert your item into the datasource
and the gridview will be updated reflecting these changes.

Here is a snippet from my own app. In this app I have a GridView with
3 columns, and in the footer I placed 2 textboxes and an "Add" button.
As you can see below, the textboxes are named txtNewURL and
txtNewURLNPages . Then I'm using an ObjectDataSourc e with 2 insert
parameters (I put the code below too).

ServiceConfigur ation.aspx ("Actions" column in the GridView)

<asp:TemplateFi eld HeaderText="Act ions">
....
<FooterTemplate >
<asp:Button id="cmdAddURL" runat="server" Text="Add"
__designer:wfdi d="w4" CommandName="Ad dURL"></asp:Button>
</FooterTemplate>
....
</asp:TemplateFie ld>
ServiceConfigur ation.aspx.cs:

protected void gridTargetURLs_ RowCommand(obje ct sender,
GridViewCommand EventArgs e)
{
if (e.CommandName. Equals("AddURL" ))
{
string url =
((TextBox)gridT argetURLs.Foote rRow.FindContro l("txtNewURL")) .Text;
string szNumberOfPages =
((TextBox)gridT argetURLs.Foote rRow.FindContro l("txtNewURLNPa ges")).Text;
DS_Urls.InsertP arameters["url"].DefaultValue = url;
DS_Urls.InsertP arameters["numberOfPa ges"].DefaultValue =
szNumberOfPages ;
DS_Urls.Insert( );
}
}
Now the ObjectDataSourc e stuff (you could use any other data source
though):

ServiceConfigur ation.aspx:
<asp:ObjectData Source
ID="DS_Urls" runat="server" DeleteMethod="O DS_TargetURLDel ete"
InsertMethod="O DS_TargetURLIns ert"
OnObjectCreatin g="DS_Urls_Obje ctCreating"
SelectMethod="O DS_TargetURLSel ect" TypeName="CWSer vice"
UpdateMethod="O DS_TargetURLUpd ate">
<InsertParamete rs>
<asp:Paramete r
Name="url" Type="String" />
<asp:Paramete r
Name="numberOfP ages" Type="String" />
</
InsertParameter s>
<DeleteParamete rs>
<asp:Paramete r
Name="id" Type="Int32" />
</
DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r
Name="id" Type="Int32" />
<asp:Paramete r
Name="url" Type="String" />
<asp:Paramete r
Name="numberOfP ages" Type="String" />
</
UpdateParameter s>
</
asp:ObjectDataS ource>
ServiceConfigur ation.aspx.cs:

public void ODS_TargetURLIn sert(string url, string numberOfPages)
{
targetURLs.Add( new CWTargetURL(url ,
int.Parse(numbe rOfPages)));
}

Hope this helps!

Manuel Ricca
On Dec 5, 1:31 am, shapper <mdmo...@gmail. comwrote:
On Dec 4, 7:37 pm, shapper <mdmo...@gmail. comwrote:


Hello,
I am working with a ListView but I suppose that with a GridView might
be the same.
Instead of having an Insert Button on each GridView row I would like
to have only one Insert button, for example, in the GridView footer.
When this button is clicked it should put the GridView in Insert Mode
and the EditTemplate should be showed, maybe (?), in the last GridView
row.
Do you understand what I mean?
Any idea how to do this?
Thanks,
Miguel

Please, what I need is something like what you find in the following
ComponentArt Grid:

http://www.componentart.com/webui/de...pecific/grid/f...

See the button "Add Row" on bottom.
When this button is clicked the Grid goes to Edit mode and the data is
inserted in a new row after the last row.

This is what I need to do.

Any idea?

Thanks,

Miguel- Hide quoted text -

- Show quoted text -
Dec 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5047
by: sa | last post by:
can i insert button into listview column if yes how?
1
1837
by: luna | last post by:
trying to create an update/insert button basically if the record exists in the database i want to do an update if it doesnt exist i want to create a new record using insert all using the same button my code (which is a mess from playing around!) (this is a test page im playing with) ID in the database is auto increment just cant seem to get anything to work (id rather have it checking the database for the exisitence of an ID rather
3
13765
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
3
3932
by: jobs | last post by:
I know native gridview does not support this and/insert of new rows.. what's killing me is I use to have this code that worked around this but somehow I lost it. I recall suffering through it. Would anybody have a sample of this in vb.net? A simple gridview with line edit option an add button outside the grid. When the add is selected a blank row with textboxes and dropdowns at the top of grid allows for insert of a new row into the...
1
1851
by: mbharathiraja | last post by:
I am doing a shopping cart in asp.net I am using a gridview.when a user checks the rows of grid view it should get selected. now, through a button(OUTSIDE Gridview),I should be able to insert the selected rows into database
0
2117
by: shapper | last post by:
Hello, Is it possible to, instead of having the GridView Insert in each GridView row, have it before the GridView or maybe in the GridView footer? Thanks, Miguel
0
2827
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation. What happened is if I select cancel on my confirmation button, it executes the griedview postback which i assigned in my code behind. Please see my codes below... Code beind: protected void gvDefectCatalog_RowDataBound(object sender,...
1
1159
by: sejal17 | last post by:
Hello everyone, I have a problem with taking button in gridview and datalist.In datalist,i have one field to display naming card_price and one button naming BUY.I want to click that BUY button and take the card_price on that row in session.so tht clicking on that button i can go on other page with that card_price. Please help me on this. Thanx.....
4
2290
by: bala venkata siva ram kum | last post by:
Hi friends, I need to get confirm message box while clicking delete button of gridview.please tell me the solution.
0
9921
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10700
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9536
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7934
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7098
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5763
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4177
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.