473,654 Members | 3,104 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 10844
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
5025
by: sa | last post by:
can i insert button into listview column if yes how?
1
1829
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
13738
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
3922
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
1843
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
2097
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
2804
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
1152
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
2280
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
8294
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7309
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
6162
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
5627
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
4150
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
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.