Client Side events and Server side binding

I want to filter a dataset, server side and bind it to a select control. Problem is my filtering must be done based on the text written by the user in a text input. To get this text i'm using client side keyboard events.

I tried to use client side binding and it works fine, but the problem is my dataset has more than 10000 rows, and so the performance is awful. Only thing i can do i think is to rebind the select control to a filtered dataset, improving performance. This is my code at the moment:

In the aspx:

static

HtmlSelect _control = null;

[

WebMethod(EnableSession = true)]

public static void SetData(DataTable result)

{

HtmlSelect control = _control;

control.DataSource = result.DataSet;

control.DataMember =

"campaigns";

control.DataTextField =

"name";

control.DataValueField =

"id_campaign";

control.DataBind();

}

JavaScript:

function

Filtering(textBox)

{

FilterData.GetData(textBox.value, OnDataRequestComplete);

}

 

function OnDataRequestComplete(result)

{

PageMethods.SetData(result);

var RsltElem = document.getElementById("Results");

RsltElem.innerHTML =

"Done";

}

 

In The WebService FilterData:

[

WebMethod(EnableSession = true)]

public DataTable GetData(string filter)

{

DataSet ds1 = new DataSet();

DataSet result = new DataSet();

if (Session != null && Session["DataSet"] != null)

ds1 = (

DataSet)Session["DataSet"];

else

{

ds1.ReadXml(

"c:\\t.xml", XmlReadMode.InferSchema);

Session[

"DataSet"] = ds1;

}

if (String.IsNullOrEmpty(filter))

filter =

String.Empty;

DataRow[] rows = ds1.Tables[0].Select("name LIKE '*" + filter + "*'", "name asc");

result.Merge(rows);

return result.Tables[0];

}

 

I have a javascript exception "PageMethods is not defined" can anyone help me with this one? Thanks

0
rumbafum
11/7/2006 6:18:12 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

0 Replies
1648 Views

Similar Articles

[PageSpeed] 53

Reply:

Similar Artilces:

Firing both Client side event and server side event for server side button
I am having some difficulties getting this to work.. I have button_click (Asp.net) and ClientClick (Javascript).  Javascript is firing fine.  Server script is not. may be you have return return false in the in the javascript which is why its not firing server side event.You should add javascript evelt like thisbutton1.onclientclick = "functionname" Function should nopt return false. Vikram www.vikramlakhotia.comPlease mark the answer if it helped you...

Help with client side events Vs. server side events
Hi, Can someone look as the following script and tell me why marking the check box doesn't generate a client side event eventhough there's: onclick="checkClick()"? marked.  Thanks in advance, Sivan <%@ Page Language="c#" %><HTML> <HEAD>  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body>  <SCRIPT language="c#" runat="Server">  void Page_Load(object s, EventArgs e) {  if (!Page.IsPostBack)  {   Label1.Text = Label...

Client side/server side event race.
 Hi.  I've got a page that 1) Takes some text fields as input2) Does some math calculations on the input (server side via a "calculate" button click)3) Then opens a new window with some detailed information (client side, via a "view report" button click)The server needs to "calculate" before the user can click "view report" so I start with "view report" disabled.  I've got input validation on the "calculate" click, and at the end, I enable the "view report" button.  Everything is working well wi...

Stop execution of server side event from client side
Dear All  I have a text box and i wrote code on the server side event( On Text Change). So when i write something on the text box it goes to server and execute the server side code. Now i want to control this sever execution from client side. i mean i want to cancel this postback from client side under some conition. can anyone plz help me? Regards Sure if you let us know what you want to be done. here is an example <asp:textbox id="txtFile" OnTextChanged="javascript:RefreshPage();" Visible=true Width=500 Runat=server/> function RefreshPage() { &nb...

executing my own function @ server side for a client side event
hi all, I have a client side dropdownlist control with onchange event. I am calling form1.submit() method in onchange event. is it possible to catch that event at server side ???ThanksPrashanth.J Not if you call form1.submit(). Try replacing that with <%= ClientScript.GetPostBackEventReference(DropDownList1, string.Empty) %>; Then in the Page_Load handler server-side: private void Page_Load(object sender, System.EventArgs e){ if ( this.IsPostBack ) {  // Place any code that needs to be executed ONLY on a post-back here.  string eventTarget = (this.Req...

Calling server-side methods from client-side event
Hello,i'm novice in asp.net client-side script and i have a simple question: is it possibile to call a server-side method (ex. c# managed code) from a java script client-side function linked to an event?Thanks all  Luca GuccioneGenova, Italy Yes you can. It's very easy using web methods from code behind, jquery and the script manager. See this very good blog post explaining the steps: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ mySoZa lucaguccione: Hello, i'm novice in asp.net client-side script and i have a simple quest...

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in asp.net ( required field, range validator and others)..my question is the required field validator is a server side control. So does that mean that it does a post back?..is it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

How to fire a server side Sub after client side event?
Hi,  How can i fire a server side event after a client side event..? For example, just an example, i want to show a "message box" - The debugging one: MsgBox(stuffs), or calls any other functions which requires the clicked button's id? I took a look on stuffs like getPostBackEventReference()... Did i in the wrong way? Any help or quick sample would be very much appreciated!! :D Hi, you can call the doPostBack (first argument is the control-Id) method, see my code snippet:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Testpage.aspx.cs" Inhe...

Accessing server-side variables from client-side events
This is a multi-part message in MIME format. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable In a client-side itemchanged function, how can I set a server-side = variable?? I simply need to execute the following: psSession.SetValue("userID", user_id); I'm sure there's a way to trigger server-side script and pass in = variables. Any suggestions?? Thanks. ------=_NextPart_000_00E8_01C04D70.7EAC7080 Content-Type: text/html; charset="iso-8859-1" ...

doing client-side action after server-side event ends
 I have a asp-button;I want it to perform a client-side action after completion of the sever-side action((like:calling a javascript function after the click event of the button ends); You can inject some javascript from the server side button click event so that when the page renders on the client side it will invoke the function or javascript fragment. You can use the method Page.RegisterStartupScript to inject javascript, or you can assign the javascript fragment to a literal control which would be interpreted when the page renders on client side.  Can u add some code snippe...

Advantage of calling Webservice from server side/client side.
Hi Folks,      I've an issue sending/receiving huge amount of data from webservices. When a webmethod is called from javascript, it fails due to the size restriction of the data (> 4MB) that can be transferred. My application architechture do have webservices and asp.net applications hosted on the same server. I'm wondering, if I can make a PageMethod call to a static method on my codebehind file and then the static method makes a call to the webservice would solve the issue? Any thoughts on this, would be really helpful? (I was trying to use WSE3.0 to incres...

How can you raise server side event from client side
Let's say I have an event on server side that handles button_click. how can I raise that event from client side using AJAX. You can create a script in a string variable, and register withScriptManager.RegisterStartupScript http://msdn.microsoft.com/en-us/library/bb359558.aspx string script = "alert('ciao!')";ScriptManager.RegisterStartupScript( this, this.GetType(), "Alert", script, true );If this answers your question, please select 'mark as answer' thanks!Andrea DottorMicrosoft MVP - ASP/ASP.NEThttp://blog.dottor.net For buttons you can use JQu...

Call client side and server side events together.
I have one textbox on my aspx page.I want to validate amount in that textbox. If it exceeds 100 then the alert message should show that amount is bigger.And it should not go further. But if the amount is less than or equal to 100, then after checking the condition onclientside, it should to the server side TextChanged event.I have written a javascript function which is being called on "onchange" event of textbox and if the value is valid, then it should call serverside textchanged event of the same textbox.Please its urgent. Mark it as Answer if you find it Helpful.Shailen  ...

Web resources about - Client Side events and Server side binding - asp.net.networking-webservices

Binding selectivity - Wikipedia, the free encyclopedia
The concept of selectivity is used to quantify the extent to which a given substrate, A, binds two different ligands, B and C. The simplest case ...

Facebook To Hold Non-Binding Shareholder Advisory Votes On Executives’ Compensation Every Three Years ...
... filing with the Securities and Exchange Commission Wednesday that, as voted on at its annual meeting in June, the company will hold non-binding ...

Molecule World DNA Binding Lab
Get Molecule World DNA Binding Lab on the App Store. See screenshots and ratings, and read customer reviews.

Whitehurst Printing and Binding Co. - Flickr - Photo Sharing!
Photo of Whitehurst Printing and Binding Co. ghost sign in Troy, N.Y. Shot with Agfa Chief camera, GAF Aerographic film (expiration 1976). Photo ...

Binding of Isaac - Top Tips For Survival - DoTheGames - YouTube
Subscribe: http://bit.ly/XAyM4G Twitter: http://bit.ly/T3CQTI Basically a handful of tips that weren't on any Wikis or available without trawling ...

Bill Shorten, Anthony Albanese reject call for binding vote on same-sex marriage
Union leader Paul Howes' call for the ALP to move to a binding vote in support of same-sex marriage has been rejected by Labor's potential leaders. ...

NSW seeks binding bids in Delta Coastal sale
Participants view AGL’s progress in the MacGen deal as a good omen for regulatory consent.

Abigail claims victory with a hushed, spell-binding display
As Abigail Carungay stepped up to the microphone in the final rounds of the Premier's Spelling Bee, the audience leaned forward in their chairs ...

Canada backs U.S., saying carbon-reduction targets shouldn't be legally binding
... approach to major climate change talks in Paris, saying any carbon reduction targets agreed to at the negotiations should not be legally binding. ...

Paris climate talks shift from binding targets to ‘name and shame’
Even if the international climate accord being negotiated in Paris becomes legally binding, it won't include punitive measures like trade sanctions ...

Resources last updated: 12/26/2015 5:04:05 AM