473,770 Members | 5,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

specify row to edit when opening formview from gridview?

What is the best way to have a FormView page open on a specific row selected
from a GridView?

I'm passing the primary key in the url as in
detailview.aspx ?mode=edit&pk=4 2

I'm using an SqlDataSource to bind the FormView to the data.

Thanks for any samples or links.
Mar 22 '06 #1
3 4474
Don't pass the primary key in URL, instead, have your SelectCommand statement
for your SQL datasource that is bound to the formview read something like

"Select PrimaryKey, field1, field2, fields3 from table where
primarykey=@Pri maryKey"

then have a <SelectParamete rs> section that reads something like this

<SelectParamete rs>
<asp:ControlPar ameter ControlID="Form ViewID" Name="PrimaryKe y"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

Then it will just work.

"Dabbler" wrote:
What is the best way to have a FormView page open on a specific row selected
from a GridView?

I'm passing the primary key in the url as in
detailview.aspx ?mode=edit&pk=4 2

I'm using an SqlDataSource to bind the FormView to the data.

Thanks for any samples or links.

Mar 22 '06 #2

My mistake for being unclear. The Gridview is on one page, selecting the row
is supposed to open another page with a FormView. This table has lots of rows
and columns so I can't put both on one page.

The real gist of the question is, how does one specify what row a FormView
should edit as the page loads?

Thanks.

"clickon" wrote:
Don't pass the primary key in URL, instead, have your SelectCommand statement
for your SQL datasource that is bound to the formview read something like

"Select PrimaryKey, field1, field2, fields3 from table where
primarykey=@Pri maryKey"

then have a <SelectParamete rs> section that reads something like this

<SelectParamete rs>
<asp:ControlPar ameter ControlID="Form ViewID" Name="PrimaryKe y"
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>

Then it will just work.

"Dabbler" wrote:
What is the best way to have a FormView page open on a specific row selected
from a GridView?

I'm passing the primary key in the url as in
detailview.aspx ?mode=edit&pk=4 2

I'm using an SqlDataSource to bind the FormView to the data.

Thanks for any samples or links.

Mar 23 '06 #3
In your FormView datasource object you can specify a QueryStringPara mter that
picks up the value that you passed through the URL
http://msdn2.microsoft.com/en-us/lib...er(VS.80).aspx

For example, you can write:
<SelectParamete rs>
<asp:QueryStrin gParameter Name="VanId" QueryStringFiel d="pk" />
</SelectParameter s>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
What is the best way to have a FormView page open on a specific row selected
from a GridView?

I'm passing the primary key in the url as in
detailview.aspx ?mode=edit&pk=4 2

I'm using an SqlDataSource to bind the FormView to the data.

Thanks for any samples or links.

Mar 23 '06 #4

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

Similar topics

2
8743
by: P. Yanzick | last post by:
Hello, I am creating an edit template for a FormView control, changing one of the textboxes to a dropdown box. The dropdown will be populated from a simple table with the primary key, and a description (i.e. a colors table, so there is a colors ID and a color description). The data source the FormView is pulling data from stores (in this example) the primary key for the colors table. My ultimate goal is when the FormView goes into...
7
4353
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the sqldatasource of the formview. If i put this textboxes outside the table everything works well, but as soon as i put them inside the table (in order to organize the layout in the right way) they doesn't work. They works only as eval() and not bind()...
1
2149
by: mosscliffe | last post by:
Is it possible to get a GridView 'Select' to go straight to the 'Edit' of a Formview. If I add a 'New' button to the GridView can I get that to go straight to the Insert of a FormView. Is it possible to trap the event of 'Update' Button Pressed in FormView. When I select the linkButton in Formview Thanks for any help / pointers.
0
908
by: tarscher | last post by:
Hi all, I have a gridview containing the edit functionality. When I use the edit function and click update another validator is triggered. That validator is not attached to the gridview since it is bound to another control (Issuetextbox) ControlToValidate="IssueTextBox". How come that this validator is triggered while it has nothing to do with the gridview? I found in msdn
0
986
by: David | last post by:
I have a GridView with an Edit command. I am setting a flag when the edit starts and turning it off when the row is updated. I want to give the user a warning (I am using onbeforeunload javascript function in body) if they select Edit but do not Cancel or Update. However, when the Cancel button is clicked, the page leaves and the warning pops up. How can I bypass the warning in this situation? Thanks. p.s. I use this same process on...
0
1596
by: Q. John Chen | last post by:
I have a GridView and a FormView serve as master/detail relation. The GridView has paging enabled - 10 rows/page. The formView is linked to gridView's SelectedValue as the sole parameter. All works well, for example: 1. Select the first row in GridView; The FormView shows the detail correspond to the first record.
1
3396
by: shapper | last post by:
Hello, In have a web page layout with various panels. One panel contains a GridView and other panel contains various TextBox, DropDownList, etc. When I click a a GridView row I make visible the Form Panel so that the user can edit the data. My questions are:
1
1582
by: shapper | last post by:
Hello, I have a GridView where each row has an EDIT and a DELETE buttons. I also have a FormView with TextBoxes, DropDownLists, etc. When an EDIT button is pressed I make the MyFormView.Visible = True. My questions are:
1
1740
by: mans | last post by:
Hello, I want to enable the edit template in a FormView from program. How can I do this? The FormView bound to a table and I don't want that it do the edit/add/delete but I control when it can do this.
0
9595
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
9432
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
10232
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
10059
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...
1
10008
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9873
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...
1
7420
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
5313
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...
3
2822
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.