0

I have very similar senario in my application. I want to find best practice in this senario.
Mostly I have a master GridView In my page. this master Gridview may perform these actions :
Add new record

  1. Adding new record
  2. Deleting a record
  3. Searching data that binded in GridView
  4. Displaying detail Information about selected record in GridView.

So for adding new record I'm using a dialog or other similar jQuery plugins
For Deleting records I'm making full postback to refresh data after confirm dialog and sometimes I'm putting target GridView in an ASP.NET UpdatePanel to prevent full postback.
Also for searching data I had to making full postback I think I have no way to doing this action without postback (Consider complex gridview)
And for displaying more detail information about current record without postback I have 2 ways :

  1. I'm using to loading an ASP.NET usercontrol asynchronous, but regard to this thread I'm not able to doing ServerSide actions with postback because of some unsolvable reasons.
  2. another way that often launched my work is this : for example I want to display a listbox and a treeview about a record in jQuery Dialog. I putted them in an updatepanel and I'm writing binding codes in a server side button and hiding this button,then I'm triggering click event of Binding button in OnOpen event of jQuery Dialog.
    due My softwares are running in local and ethernet I don't care SEO.
    As I'm a novice programmer please share your expriences with me, note me where I'm wrong(maybe everywhere !) and where I can using better ways. thanks.
4
  • Please comment me if question is not clear. Commented May 10, 2011 at 17:13
  • 1
    My personal best practice is use ASP.NET MVC or manos de mono as it provides far better ajax patterns then ASP.NET. If you want to fully lever ajax you might aswell switch to a tool you don't have to fight as hard. Commented May 10, 2011 at 17:23
  • @Raynos , it seems I should learn ASP.NET MVC. thanks Commented May 11, 2011 at 9:24
  • It's worth doing. It's an improved model on top of ASP.NET. But if your going to pick something new might aswell broaden your entire field and take a look at competitors (python, ruby, php, perl, js, etc.) Commented May 11, 2011 at 9:59

1 Answer 1

1

When I use jQuery, I prefer to avoid GridView and any other control that generates stupid HTML with obstrusive JavaScript.

I suggest you to look at my answer to this question: The using of ajax in asp.net.

There you'll find many links and suggestions to create a consistent architecture using jQuery AJAX with ASP.NET.

Sign up to request clarification or add additional context in comments.

7 Comments

Almost all <asp:...> controls generate bad HTML. What's the use case for using ASP.NET if the controls are not used. It feels like this is fighting the tool and should pick a different tool.
I personally loves coding the server-side with ASP.NET. The C# language, its possibilities and also the numerous .NET Framework packages are great attractions for me. In these scenarios, the controls are bad, but the rest is really good. Indeed there is also the ASP.NET MVC that generates much less "trash" and gives you more control to the desired HTML. But it is always a matter of taste.
@Raynos: Personally, I've found myself taking that approach somewhat often, when working inside existing WebForms projects. I end up just using ASP.NET as a backend to render skeleton HTML and then use it to expose JSON endpoints so that the client-side code can handle the rest.
@DaveWard I sometimes feel like I'm treating ASP.NET as a thin abstraction on SQL Server.
@ErickPetru I guess you can leave all the rendering to HTML and JS and just store all your models and logic in C#. I find that writing the models and logic as a F# class library is actually useful in such cases sometimes. Could you name some good ".NET Framework packages" (apart from SQL Server).
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.