• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

accessing gridview from a different page

Hi All,
I have a Gridview is page1 which has several rows in it.
I have a button in page2 which when clicked has to disable few rows in Gridview from page1.
How can this be done?

Thanks..
Rohit
0
RohitRepu
Asked:
RohitRepu
  • 2
1 Solution
 
ororioleCommented:
First we need to clarify. Is a Gridview control also displayed on page 2 that displays the same data as the Gridview on page 1 (except for the disabled rows)?
0
 
RohitRepuAuthor Commented:
Hi Ororiole,

No, there is no gridview on page 2.
But i need put a condition in page 2  in a button click event
such that when page 2 is executed the rows in gridview on page1 gets disabled.

Thanks...
Rohit.
0
 
ororioleCommented:
Server page programming is stateless. That means when you are on page two there is no Gridview control on page 1 to access.  It only exists when page 1 is running on the server.

What you need to do is create a Session variable when the button is clicked. So inside your button click eventhandler on page two do this:
Session("clicked") = True

Now in page one you can check to see if the Session variable has been set:

        If Not Session("click") Is Nothing Then
            Dim click As Boolean = CType(Session("click"), Boolean)
 
            If click = True Then
                'do something with gridview
            End If
 
        End If

Open in new window

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now