GridView - Select Row

S

shapper

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top