Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Page_Load fires twice webforms set up with master page
10/04/2012
03:42
Avatar
cr8zymike
Member
Members
Forum Posts: 4
Member Since:
10/04/2012
sp_UserOfflineSmall Offline

Hello!

I'm new to jQuery so it has been a bit of a learning curve. 

We are using jQuery with an ASP .Net web forms application.

I was playing around and did a very simple example where I get the values back from the database in a datatable and then bind it just like the example.

 <cc1:JQGrid ID="Jqgrid1" runat="server"  MultiSelect=true Width=100% >
        <Columns>
            <cc1:JQGridColumn HeaderText="ID" DataField="ContactID" PrimaryKey="true" />
            <cc1:JQGridColumn HeaderText="Title" DataField="Title" Editable="true"/>
            <cc1:JQGridColumn HeaderText="First Name" DataField="FirstName" Editable="true"/>
            <cc1:JQGridColumn HeaderText="Last Name" DataField="LastName" Editable="true"/>
            <cc1:JQGridColumn HeaderText="Email Address" DataField="EmailAddress" Editable="true"/>
                            
        </Columns>   
        <ToolBarSettings ShowRefreshButton="True" ShowSearchButton="True" />
      </cc1:JQGrid>

In the Page_Load event:

 DataTable dt = testData.GetContactDataTable();

 Jqgrid1.DataSource = dt;
 Jqgrid1.DataBind();

When I run it I get the results in the jqGrid.  Great!  When I looked at the code behind, I notice that it fires up twice. I forgot to check for postbacks, so I added that in to see if that fixed it.  Nope.  If I take away the jqGrid the page load only fires once.  So somewhere it's firing it twice.  I'm thinking it must be something simple that i've overlooked but can't figure get it out of the head. Yell

Any suggestions are greatly appreciated!

10/04/2012
04:32
Avatar
cr8zymike
Member
Members
Forum Posts: 4
Member Since:
10/04/2012
sp_UserOfflineSmall Offline

So after some banging on the head and looking over the documentation…

It looks like this works:

if (!Page.IsPostBack && Jqgrid1.AjaxCallBackMode == AjaxCallBackMode.RequestData)
{

}

I'm thinking this is the answer…unless someone tells me that i'm doing a stupid hack Cool

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
44 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information