set selected index of gridview on load

Discussion in 'ASP .Net' started by WebBuilder451, May 2, 2008.

  1. I have the datakey for the gridview passed to the page using cross postback.
    How can i set the selected index of the page using this value, but only on
    load where a previous page (cross post back) exists?
    --
    (i''ll be asking a lot of these, but I find C# totally way cooler than vb
    and there''s no go''n back!!!)
    thanks (as always)

    kes
     
    WebBuilder451, May 2, 2008
    #1
    1. Advertisements

  2. WebBuilder451

    Teemu Keiski Guest

    Hi,

    you can check for cross-page postback on the target page by checking
    PreviousPage property for null reference. I've blogged about that at:
    http://aspadvice.com/blogs/joteke/a...age-and-PreviousPage.IsCrossPagePostBack.aspx

    So basically in Page_Load of your target page, check with previous technique
    if you're in cross-page post and if you are then just set the property .

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net

    "WebBuilder451" <> wrote in message
    news:...
    >I have the datakey for the gridview passed to the page using cross
    >postback.
    > How can i set the selected index of the page using this value, but only
    > on
    > load where a previous page (cross post back) exists?
    > --
    > (i''ll be asking a lot of these, but I find C# totally way cooler than vb
    > and there''s no go''n back!!!)
    > thanks (as always)
    >
    > kes
     
    Teemu Keiski, May 3, 2008
    #2
    1. Advertisements

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. David
    Replies:
    6
    Views:
    77,812
    n3xus
    Jan 7, 2011
  2. Child X

    GridView Selected Index!

    Child X, Oct 28, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    883
    Child X
    Oct 28, 2006
  3. Paul
    Replies:
    3
    Views:
    1,341
  4. Sobin Thomas
    Replies:
    1
    Views:
    1,297
    Munna
    Aug 12, 2008
  5. mldardy
    Replies:
    0
    Views:
    1,153
    mldardy
    Sep 28, 2010
  6. 11D.Universe

    How to programatically set GridView selected row?

    11D.Universe, Jun 17, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    2,240
    Sriram Surapureddy
    Jun 20, 2007
  7. Seth Rasmussen
    Replies:
    3
    Views:
    331
    Seth Rasmussen
    Sep 17, 2005
  8. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    598
    Tomasz Chmielewski
    Mar 4, 2008
Loading...