Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am having a grid which wil be binded aftr the button is clicked. I want to avoid the page load event on the button click you jquery. Pleae help me on this.

Thanks....
Posted

Page load event will always fire on postback if you dont want to execute the code

put i in !isPostBack Condition

VB
if (!isPostBack)

{

//Place the code here

}
 
Share this answer
 
VB
If Not Page.IsPostBack Then
                btnAddSub.Visible = False
               
            End If
 
Share this answer
 
In this case you need to use jquery/Javascript.Without javascript whenever you click on your button PageLoad will be Fired.

another scenario is if you don't have any code written on the PageLoad then Set the AutoEventWireup="False" in page directive of .aspx page.By setting this property this function will not be called.
 
Share this answer
 
Already I have a piece of code in
VB
If Not Page.IsPostBack Then
                btnAddSub.Visible = False
                btnExportToExcel.Visible = False
                btnExtract.Visible = True
                gvBVALPrices.Visible = False
            End If


On the click event of the button , i have the following code which shows the check box.

VB
Protected Sub btnAddSub_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSub.Click

        dv.Visible = True

        chkColumns.Items.Clear()
        Dim count As Integer = gvBVALPrices.Columns.Count
        Dim i As Integer
        For i = 0 To count - 1
            chkColumns.Items.Add(gvBVALPrices.Columns(i).ToString)
        Next
        chkColumns.Items(0).Selected = True
        chkColumns.Items(1).Selected = True
        chkColumns.Items(2).Selected = True
        chkColumns.Items(3).Selected = True
        chkColumns.Items(4).Selected = True
        chkColumns.Items(5).Selected = True

    End Sub


So please provide me a jquery to prevent the page load on the button click event.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900