GridView - Select Row

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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.
 
Back
Top