473,385 Members | 1,732 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,385 software developers and data experts.

GridView - Select Row

Hello,

I have a two elements on my page: a GridView and form that has various
controls (textboxes, dropdownlists, etc)

When I click a GridView row I need to fill the form controls.
I will use visible and invisible columns in the gridview selected row.

Then I when I click the button of the form I am submitting the form
values but there are also a few values which I don't want to show in
the form, like RecordId (GUID) but then I will need to submit.

How should I do this?

Thanks,
Miguel

Jun 22 '07 #1
1 1716
one way to do this is using javascript.
In itemdatabound event of grid view add the attribute like this

if (e.Item.ItemType != ListItemType.Header && e.Item.ItemType !=
ListItemType.Footer)
{
e.Item.Attributes.Add("onclick", "javascript:YourFunction('" +
e.Item.Cells[0].Text + "','" + e.Item.Cells[1].Text + "','" +
e.Item.Cells[2].Text + "','" + e.Item.Cells[3].Text + "','" +
(e.Item.ItemIndex + 1) + "')");
}
and in the javascript function YourFunction assign the values to the form
controls using document.elementbyid function

Hope this helps.

"shapper" wrote:
Hello,

I have a two elements on my page: a GridView and form that has various
controls (textboxes, dropdownlists, etc)

When I click a GridView row I need to fill the form controls.
I will use visible and invisible columns in the gridview selected row.

Then I when I click the button of the form I am submitting the form
values but there are also a few values which I don't want to show in
the form, like RecordId (GUID) but then I will need to submit.

How should I do this?

Thanks,
Miguel

Jun 22 '07 #2

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

Similar topics

7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
6
by: Terry | last post by:
Good morning! How do I determine which SELECT button was clicked in a GridView? The multiple SELECT buttons will be used for an application approval process. Thank you in advance for your...
4
by: Don Miller | last post by:
This is a repost of a reproducible problem/bug with GridView with dynamic SQL and binding. Is there a better ASP.NET newsgroup I should post to where MS techs or MVPs take an interest in such...
4
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This...
0
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
Hi, I have created a second gridview when customer clicks on select link with this code: Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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...

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.