473,427 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,427 software developers and data experts.

Discover the primary key values in a gridview while editing it

The Gridview's RowDeleting event, give the power - cycling the e.Keys Dictionary,
to discover
the values of the Primary key fields of the dataset setup throught the DataKeyNames.

Since I want to get the same value to display a more detailied form to edit
my gridview fields
that cannot be contained in a gridview, How can I do that?

Any link, sample etc?

Thanks.
Andrea

Jun 7 '06 #1
3 3482
Andrea <googlegroups@fuck_the_spam_cleanmail.it>'s wild
thoughts were released on Wed, 7 Jun 2006 22:08:15 +0000
(UTC) bearing the following fruit:
The Gridview's RowDeleting event, give the power - cycling the e.Keys Dictionary,
to discover
the values of the Primary key fields of the dataset setup throught the DataKeyNames.

Since I want to get the same value to display a more detailied form to edit
my gridview fields
that cannot be contained in a gridview, How can I do that?

Any link, sample etc?


I'm afraid I don't understand the question, could you
rephrase it?
Jan Hyde (VB MVP)

--
Lottery: A tax on people who are bad at math.

Jun 8 '06 #2
> I'm afraid I don't understand the question, could you rephrase it?

I think a sample could let anyone understand.

protected void GridViewMain_RowDeleting(object sender, GridViewDeleteEventArgs
e)
{
foreach (DictionaryEntry de in e.Keys)
{
....
}
}

Ok ... with code above, asking for de.Values, I'm able to get the values
of the PrimaryKeys
of the bounded dataSet.

What I need is to get the same values also in RowEditing events, but the
event structure
is different and I've not direct access to that data.

I tried then to add two hidden columns where report the values that I need,
as showed
in the MSDN sample, with the code below I should be able to get the value
of a X column

void CustomersGridView_RowEditing(Object sender, GridViewEditEventArgs e)
{

// Get the country for the row being edited. For this example, the
// country is contained in the seventh column (index 6).
String country = CustomersGridView.Rows[e.NewEditIndex].Cells[6].Text;

.....

I don't changed the code, it's exactly like MSDN display, but in my code,
simple changing
the control name and the cell where the data is stored, I got an empty text
for all cells.

So I don't know how to get my value and continue the editing.
I want, after intercepted the value of the row is being edited, to display
a different edit
form and not let user edit that value inside the gridview.

If you have some sample or link I can read, I'll appreciate it.

Thank
Andrea


Jun 8 '06 #3
Well that's the reply

GridViewMain.DataKeys[e.NewEditIndex].Values[X]

Thanks
Andrea

Jun 8 '06 #4

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

Similar topics

9
by: Neil | last post by:
I've been discussing here a SQL 7 view which scrolls slowly when linked to an Access 2000 MDB. After trying various things, I've distilled it down to the following: when the linked view has a...
1
by: BStorm | last post by:
Does anyone know the best way to update a DataTable row column using specific values for a multipart primary key? For example, updating an OrderAmt column in an OrderDetail table where the...
13
by: anonymike | last post by:
Hello, I started working with the ObjectDataSource today. I have the select, and have been working on getting the update method to work. Here is the asp code for my Data source: ...
1
by: Kyle K. | last post by:
I would like to build my data pages such that the top of the page contains a GridView showing the data with 'Enable Select = true'. Below that I would like to have a FormView, that by default is...
4
by: Tomasz Jastrzebski | last post by:
Hello Everyone, I have a GridView control bound to a plain DataTable object. AutoGenerateEditButton is set to true, Edit button gets displayed, and RowEditing event fires as expected.
3
by: cpnet | last post by:
I have a GridView which I'm populating from an ObjectDataSource (give the GridView a DataTable). The GridView will have about 20 rows, and only one editable column. The editable column consists...
1
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
Hi, I have a gridview which I added a <asp:CommandField EditText="E" CancelText="C" UpdateText="U" ButtonType="Link" ShowEditButton="True" /> my gridview looks like this <asp:GridView...
5
by: =?Utf-8?B?Z3V5?= | last post by:
How do you enable editing in a GridView programatically rather than via its Tasks menu? Guy
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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
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...
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...

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.