C# | Asp.Net | MVC | SQL Server | jQuery | Java Script | Angular | .Net Core | Microservices
You are here » Home » All posts
Tuesday, December 31, 2013
Friday, December 13, 2013
How To- Load ASP.Net User Control Dynamically Using jQuery and Ajax
Here in this post, I am going to explain how to dynamically load the Asp.Net user control using jQuery and Ajax. For loading the user control we will use the Web Method on server side and call that web method through Ajax call using jQuery.
You can also find my other articles related to C#, ASP.Net, jQuery, Java Script and SQL Server.
So, lets start the example. In this example I have used one aspx page name Demo.aspx and one user control to load on the aspx page DemoUserControl.ascx.
ASPX Page
In the above aspx page, there are two TextBoxes for capturing the input and one Button to load the user control and show the enterd value.
You can also find my other articles related to C#, ASP.Net, jQuery, Java Script and SQL Server.
So, lets start the example. In this example I have used one aspx page name Demo.aspx and one user control to load on the aspx page DemoUserControl.ascx.
ASPX Page
<div style="width:350px"> <table width="100%"> <tr> <td> <asp:Label ID="lblName" runat="server" Font-Bold="true" Text="Name"></asp:Label> </td> <td> <asp:TextBox ID="txtName" runat="server"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label ID="lblAge" runat="server" Font-Bold="true" Text="Age"></asp:Label> </td> <td> <asp:TextBox ID="txtAge" runat="server"></asp:TextBox> </td> </tr> <tr> <td colspan="2"> <asp:Button ID="btnLoadUserControl" runat="server" Text="LoadControl" /> </td> </tr> </table> </div> <fieldset style="width:350px"> <legend>User Control Content</legend> <div id="userControlContent"> </div> </fieldset>
In the above aspx page, there are two TextBoxes for capturing the input and one Button to load the user control and show the enterd value.
Thursday, October 31, 2013
Thursday, August 29, 2013
C#: Difference between “throw” and “throw ex” in C# .Net Exception
In day to day development, we all are very familiar with Exception handling. We pretty much all know that we should wrap the code which may cause for any error in try/catch block and do something about error like give a error message to end user. Here I am not going to explain about Exception handling in C#. Instead I am going to talk about a particular aspect of Exception handling, which is "throw" vs "throw ex".
You can also find my other articles related to C#, ASP.Net, jQuery, Java Script and SQL Server. I am writing this post because I was asked this question recently in a interview and unfortunately I didn't know the answer. So I am posting this for those guys who uses "throw" and "throw ex" frequently but don't know the differences (not all,some knows).
You can also find my other articles related to C#, ASP.Net, jQuery, Java Script and SQL Server. I am writing this post because I was asked this question recently in a interview and unfortunately I didn't know the answer. So I am posting this for those guys who uses "throw" and "throw ex" frequently but don't know the differences (not all,some knows).
Difference between “throw” and “throw ex”
Take a look on the below code snippest-throw ex | throw |
---|---|
try { //Code which fails and raise the error } catch (Exception ex) { throw ex; } | try { //Code which fails and raise the error } catch (Exception ex) { throw; } |
Thursday, August 15, 2013
Subscribe to:
Posts (Atom)