Working with Callback and Control Rendering
page 1 of 8
Published: 05 Feb 2008
Abstract
In this article, Muhammad discusses the working of Callback and Controls rendering with the help of a sample application. He initially provides a short explanation of some of the important terms and then provides the steps required to accomplish the task along with both the callback server and client side codes.
by Muhammad ADnan Amanullah
Feedback
Average Rating: 
Views (Total / Last 10 Days): 41405/ 65

Introduction

In my previous article, I wrote about Callback and JSON based JavaScript serialization which you can find here. Callback doesn't cause postback and page rendering, neither full nor even partial. With it we can communicate with the server (IIS) and our server side code runs there successfully and could rebind our controls like DropDownList, GridView, ListView, DataList, Repeater, or any server side control to which you assign data. The problem is when the page won't render, its controls won't render, and if controls won't render then changes won't reflect. When changes don't reflect there won't be anything at the front end to show on the webpage.

This article is mainly about callback and rendering controls but through this tutorial you can also learn many other things; how postbacks work, how rendering works, how to dynamically create server-side controls, how to create DataTables dynamically in memory to bind with, how to get server-side controls during client-side execution and set their properties, and how to register client-side events of server side control from the server-side code.


View Entire Article

User Comments

Title: NIKE NFL jerseys   
Name: NIKE NFL jerseys
Date: 2012-07-02 10:09:17 AM
Comment:
http://www.jersey2shop.com
http://www.cheapjersey2store.com
http://www.jerseycaptain.com
http://www.yourjerseyhome.com
We are professional jerseys manufacturer from china,wholesal.cheap nike nfl jerseys, mlb jerseys, nhl jerseys,nba jerseys and shoes
Cheap NFL,NBA,MLB,NHL
,heap jerseys,2012 nike nfl Jerseys,nba jersey and shorts,oklahoma city thunder jersey,official jeremy lin new york knicks jersey,NFL Jerseys Wholesale,blake griffin jersey blue,NFL jerseys For Sale online.All Our Jerseys Are Sewn On and Directly From Chinese Jerseys Factory
,Wholesale cheap jerseys,Cheap mlb jerseys,]Nike NFL Jerseys,Cheap China Wholesae,Wholesale jerseys From China,2012 nike nfl Jerseys,Jerseys From China,,2012 nike nfl Jerseys,Revolution 30 nba jerseys,jersey of nba chicago bulls direk rose ,nfl jerseys,green bay packers jerseys wholesale,Buffalo Bills nike nfl jerseys sale,good supplier soccer jerseys,cool base mlb jerseys,Revolution 30 nba jerseys,2012 stanley cup nhl jersey,
We are professional jerseys manufacturer from china,wholesal.cheap nike nfl jerseys, mlb jerseys, nhl jerseys,nba jerseys and shoes. www.yourjerseyhome.com
Title: rendered server controls   
Name: Jatin
Date: 2009-06-26 7:44:22 AM
Comment:
is it possible to render our gridview and datalist controls instead of "grvProducts" as DIV Tag. ?

Because i have one gridview and datalist now i just want to resfresh with callback ?
so how can i achieve this thing with render ?

thanks in advanced....
Title: Re: master pages   
Name: Muhammad Adnan (Author)
Date: 2009-01-15 10:59:12 AM
Comment:
It works for sure as i did many many times, you must be missing somewhere else. you might be using this somewhere else so i would suggest you to change its name and then try....

best of luck (y)
Title: master pages   
Name: sw
Date: 2009-01-15 10:54:06 AM
Comment:
the receiveserverdata function not called while using master pages.even the getcallbackresult returns the correct html.could you please let me know,the reason that could be with this.without master pages it works.[even after prefixing the exact id for the controls it doenot work with master pages]
Title: this.renderedoutput   
Name: snow white
Date: 2009-01-12 11:28:19 PM
Comment:
The HTML string is proper ,which was got from this.renderedoutput.The problem is ,the function receiveserverdata is not getting called, as i am not getting any alert messages during the button click,after the server side GetCallbackResult() and raisecallbackevents are called.But it works fine for the dropdown changes.
Title: Re: this.renderedoutput   
Name: Muhammad Adnan (Author)
Date: 2009-01-12 9:36:00 AM
Comment:
Ok its good that you are getting data. Did you check you are getting proper HTML in This.renderedoutput after it get assigned.

If that is also OK then check please in following function that either arg parameter is getting that html string

function ReceiveServerData(arg, context)

just do alert(arg);

HTH

If you still having problem, you can email me code or its screenshot.

Thanks and best of luck
Title: This.renderedoutput   
Name: snow white
Date: 2009-01-12 9:22:20 AM
Comment:
Hi,

Now i am able to bind the dropdown with the values.But,even if i get data from DB for the datagrid,the datagrid source and all are set fine,it is not visible.can you help me?Even i tried with a gridview.The parameters for the sql query and even the dataset from the query are coming fine.
Title: Re: Re: this.renderedoutput   
Name: Muhammad Adnan (Author)
Date: 2009-01-12 1:55:00 AM
Comment:
Check whether you are getting data from db or not or you email me at adnanaman@gmail.com your code i 'll try to see and fix

Thanks
Title: this.renderedoutput   
Name: snow white
Date: 2009-01-12 1:44:16 AM
Comment:
Hi,

Thanks for your quick response.I am now clear with that.But when i tried to bind the dropdowns with db data,everything is fine without any error on debug.But the new dropdowns (created similar to subcategories of this example) are not visible.Should i add any attributes to the controls for changing visibility property.But it works fine with the same example mentioned here.In my design part i have many trs and tds which contain the target div s.Can you help me.
Title: Re: this.renderedoutput   
Name: Muhammad Adnan (Author)
Date: 2009-01-12 12:36:46 AM
Comment:
You asked about this.renderedoutput
renderedoutput is class level string type variable which i am using in multiple methods/events

Let me know if you have any further query and thanks for your feedback
Title: this.renderedoutput   
Name: snow white
Date: 2009-01-12 12:23:26 AM
Comment:
Hi,

This is really a nice article.but i am a new bie.and i get the error "page doe not have a definition for renderedoutput".Can you help me in this.
Title: Re: CallServer   
Name: Author (Muhammad Adnan Amanullah)
Date: 2008-08-18 9:40:50 AM
Comment:
Thanks for your feedback,

Yes, It is changeable, but make sure wherever it's being using, rename.

Take care, Thanks,
Title: CallServer   
Name: Tapas Pati
Date: 2008-08-18 9:30:04 AM
Comment:
This topic very good.
Please can you tell mewhat is this (CallServer(arg, context)) function? this name is default or programmer can change it?
Please tell me.
Title: i realy like it   
Name: amol kagde
Date: 2008-08-14 6:46:45 AM
Comment:
hi

this article is very very useful for me.........

thsnk you for help!!
Title: Nice Article   
Name: Saurabh Maurya
Date: 2008-07-10 2:58:04 AM
Comment:
Dear Adnan,

Its really a very good article and going to help developers to implement callbacks in their applications.

Hope to hear some more useful information in near future.
Thanks a lot.

Saurabh
Title: Re: KS   
Name: Author
Date: 2008-03-18 1:03:10 AM
Comment:
First of all, thanks, for your feedback, i would like to explain rendering in somehow informal way, hope you could understand.
Rendering: is somehow conversion of server side code to client side code means when our code executed at web server IIS, it process that request (code) and then in response send back to browser. browser can't understand the code of asp.net, c#.net, vb.net or any server side language code, so it needs to be in that format which it could understand which is client side languages or scripts like html, xhtml, dhtml, javascript,... so in rendering process. our server side language code converted to client side language/script code and return back to browser to interpret.

in my article, i processed the dropdownlists and rendered their output in markup language format and send back to javascript code for browser to interpret.

ref: http://msdn2.microsoft.com/en-us/library/aa338806(VS.71).aspx
Title: Working with Callback and Control Rendering   
Name: KS
Date: 2008-03-17 4:37:46 PM
Comment:
Could you please explain what RenderedOutput is?
Title: Good One   
Name: Uzair Aziz
Date: 2008-03-14 8:17:45 AM
Comment:
Very good example,this will really helpful if somebody don't want to do programming on dropdown's SelectedIndexChanged Event handler.it is really time saving on server side.
Title: Re: Bobo   
Name: Author
Date: 2008-03-14 2:53:10 AM
Comment:
Yes you are right. it should be:

scriptMgr.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);

thanks :)
Title: A littlte wonder   
Name: Bobo
Date: 2008-03-14 2:47:44 AM
Comment:
Read,good,but what does "cm" mean in Listing3? it should be scriptMgr,is that correct?
Title: Re: Muhammad Nadeem   
Name: Author
Date: 2008-03-13 1:55:50 PM
Comment:
surely keep you update next time sir :)
Title: good work   
Name: Muhammad Nadeem
Date: 2008-03-13 10:47:23 AM
Comment:
hi man good work.. why u did not tell us..
Title: Great piece of work   
Name: Dan Bambling
Date: 2008-03-13 9:37:15 AM
Comment:
This great, a real help and easy to understand. This sertainly solves having to rely on nested update pannels.
Title: Excelent   
Name: aliraza
Date: 2008-03-13 8:17:38 AM
Comment:
excellent, very good article
Title: Great Effort i must say.   
Name: Muhammad Moazzam Humayun
Date: 2008-03-13 5:54:21 AM
Comment:
Wow, very nice article with a superb example.

i have tested it and i love the way u have explained this technique.

:-)

Moazzam
Title: Excelent!!!!!!!!!!!!!!!!!!!!!!!!   
Name: cto-Shaukat
Date: 2008-03-13 3:19:37 AM
Comment:
Excellent article ,it solved a lot of mine problem
Title: Excellent!!!   
Name: Rajasekhar Bathula
Date: 2008-03-13 12:17:02 AM
Comment:
I have been searching for an like this.Finally,I got it.

Excellent one!!
Title: Very Nice   
Name: Matt
Date: 2008-03-12 1:06:45 PM
Comment:
Excellent, we've been looking for somethign like this! AJAX partial-postback is just too heavy.
Title: Good Article   
Name: Kauser
Date: 2008-02-05 3:45:38 PM
Comment:
You have written a very useful article. I will surely try this code. Keep it up!
Title: comments?   
Name: Muhammad Adnan
Date: 2008-02-05 12:37:09 AM
Comment:
waiting for readerz comments :)

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 6:26:00 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search