473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to set Flagvalue for Gridview

Hi,
I want my gridview to be disabled during page-load.During the button ckick only it should be enabled . I am also using paging concept in my Grid.If i make my function call at page-load it's working exactly.But i dont want my grid to be enabled at page-load .It should be enabled on button click.Someone nos help me out

here is my code.Candidatedetails is ny gridview name and quick is my table name.

Imports System.Data.Sqlclient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load()
If flg = 1 Then
Call g()
Else
CandidatesDetails.Visible = False
MsgBox("hai")
End If
End Sub

Protected Sub DisplayCandidateCount_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DisplayCandidateCount.Click
Dim db As Database = Nothing
db = DatabaseFactory.CreateDatabase("DEVTEST")
Dim count As Integer = CType(db.ExecuteScalar(CommandType.Text, "SELECT COUNT(*) FROM QUICK"), Integer)
Dim message As String = String.Format("There are {0} customers in the database", count.ToString())
MsgBox(message)
End Sub

Dim flg As Integer = 0

Public Sub DisplayCandidateList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DisplayCandidateList.Click
flg = 1
End Sub

Sub g()
Dim db As Database = Nothing
db = DatabaseFactory.CreateDatabase("DEVTEST")
Dim ds As DataSet = db.ExecuteDataSet(CommandType.Text, "SELECT CANDIDATENAME,CANDIDATEID,AGE From Quick")
Me.CandidatesDetails.DataSource = ds.Tables(0)
CandidatesDetails.AllowPaging = True
CandidatesDetails.AllowSorting = True
CandidatesDetails.EnableSortingAndPagingCallbacks = True
CandidatesDetails.PageSize = 5
CandidatesDetails.Visible = True
CandidatesDetails.DataBind()
End Sub

End Class
Jun 29 '07 #1
1 837
kenobewan
4,871 Expert 4TB
Welcome to TSDN. Which event are you planning to use to enable the grid assuming the click event won't be enabled after the page load?
Jun 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
6
by: RobertTheProgrammer | last post by:
Hi folks, Here's a weird problem... I have a nested GridView setup (i.e. a GridView within a GridView), and within the nested GridView I have a DropDownList item which has the...
3
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.