Viewstate value not getting at client side whiledoing rad grid Operation

2 posts, 0 answers
  1. Arti
    Arti avatar
    17 posts
    Member since:
    Jul 2007

    Posted 04 Jun 2008 Link to this post


    I have a rad grid in which first template column and checkbox control in that column.

    I have set  AutoPostBack="false" and write one event   OnCheckedChanged="CheckChanged" at the server side.

    in this event I am calculating the count of selected rows and stored it in VewSte("RowCount") variable.
    When I select any record by checking that checkbox and change pageindex, then first fire "CheckChanged" event (no of times as many rows selected. e.g. 2 rows selected then 2 times goes to this event) and then pageindexchanged event fire. So I have getting correct result of view state. in these events at serveside.

    There is a one button below the RadGrid which is enable disable based on no of rows selected. If no rows selected then that button is disble otherwise enable. So I need viewstate value for decide where button is enable or disable.

    I have write client click event of checkbox like OnClick=fnClientClick(),
    i which i am getting this viewstate varianble value by using
    var count = ''<%=ViewState("RowCount")%>;

    but always I get blank. I cannot get true value.

    I have also try by replacing viewstate to hiden variable.
    but I can not get value...

    Can u give me suggetion how can I get the viewstate value at client side?

    Arti Khachariya

  2. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 06 Jun 2008 Link to this post

    Can you pass this value from client to server and backwards in a simple scenario (when clicking checkbox on the page for example)? If you can do that do enable/disable the button, then transfer the code when grid is involved and everything should be fine.

Back to Top