Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Display Insert Template on FormView when "Add New" button is clicked

Reply
Thread Tools

Display Insert Template on FormView when "Add New" button is clicked

 
 
scartin@gmail.com
Guest
Posts: n/a
 
      06-01-2006
I'm fairly new to working with ASP web controls, and am running into
what seems to be a ridiculous problem that I'm hoping will be a breeze
for an experienced ASP developer.

I have a GridView and a FormView on the same page, where the GridView
is visible at page load, and the FormView is set to Edit mode by
default, but is hidden on the page. I have the Select link enabled on
my GridView, and I use the SelectedIndexChanged event to hide the
GridView, update the SelectCommand on my datasource with the
SelectedIndex, and finally show the FormView. This all works
beautifully, and I get my FormView populated with the data from the
selected Index shown on the page.

The code to handle this is fairly simple, and looks like the following:
(with the bulk of the query removed for readability)
Code:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
GridView1.Visible = false;
FormView1.Visible = true;
FormView1.ChangeMode(FormViewMode.Edit);
dsPackageEdit.SelectCommand = "SELECT ... WHERE [ID] ="
+GridView1.SelectedDataKey.Values["ID"];
FormView1.DataBind();
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display a form from webpage when button clicked cielle ASP .Net 1 10-20-2010 02:48 AM
Spring java Controller get correct data from button when "apply"button is clicked but not pressing the <Enter> key albert kao Java 1 04-10-2010 02:54 AM
Which update button is clicked in FormView ItemUpdated event? J055 ASP .Net 4 09-25-2006 02:46 AM
Display Insert Template on FormView when "Add New" button is clicked scartin@gmail.com ASP .Net 1 06-05-2006 04:04 PM
Inconsistent behavior of an asp.net button performing a postback when a button is clicked. Mossman ASP .Net 0 12-12-2005 02:55 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57