开发者

JQuery - code behind

how would you use JQuery with asp.net Code-Behind

what i mean by that: i have a div that displays the result based on some processing and this process done on code-behind and based on that result i have to display if the pro开发者_StackOverflow中文版cess went through sucessfully or not.

how would i do and is that possible? can anybody show me some sample lines of code to understand?

thanks.


it seems that your are confused over client vs server side processing.

if the process is running on your server, then you can add an asp:label to your div and then in the code-behind set your message to the label.

if the process is running on your client, then you can use jquery to set the message into your div. uses $("#message").text("insert your message here")


"Using jQuery and OData to Insert a Database Record" would be a link to an example of using jQuery with ASP.Net that would be a starting point for what you want I think.


The jQuery library is a JavaScript Library that you can use to replace or work with your standard client-side JavaScript code. jQuery is used on the client to build rich interfaces and can be used to post/get data to and from the server, it wraps a lot of existing javascript, allows quicker development and is built to work across browsers.

Have a look at the jQuery UI demos to see what jQuery can do for your interface. If you want to use it for ajax, its probably best to find a few tutorials or blogs to demonstrate working examples.


Your code behind would render the result div if successful using an asp:panel control. You could give it a class eg CssClass='resultdiv'. If you make the panel visible = false, it wont get rendered to the client.

You can use the following jquery to get the panel element:

$('div.resultdiv').each(function() {

    //Client side code here

));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜