GridView - Select Row

Discussion in 'ASP .Net' started by shapper, Jun 22, 2007.

  1. shapper

    shapper Guest

    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
    shapper, Jun 22, 2007
    #1
    1. Advertising

  2. 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
    >
    >
    =?Utf-8?B?U3JpcmFtIFN1cmFwdXJlZGR5?=, Jun 22, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fernando Lopes
    Replies:
    0
    Views:
    3,190
    Fernando Lopes
    Apr 28, 2005
  2. =?Utf-8?B?RGFiYmxlcg==?=

    select gridview row without using select button?

    =?Utf-8?B?RGFiYmxlcg==?=, Mar 3, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    101,518
    dch31969
    Feb 27, 2009
  3. H5N1
    Replies:
    0
    Views:
    2,712
  4. Replies:
    5
    Views:
    656
  5. D
    Replies:
    0
    Views:
    203
Loading...

Share This Page