Tuesday, November 20, 2012

Ext.Net Lessons for learners

How to Create a label with text.

Open you .aspx page where u want to create the label and add the following code.

<ext:Label ID="lblSample" runat="server" Text="Sample">
        </ext:Label>
Always remember that the ID of a label starts with lbl.

Now set your page as a start up page from the solution Explorer by right clicking on the page and select the option Set as a start page.
Now press F5 to run the application and you will be able to see  a label with Text as "Sample".

How To Create A Text Box.

Open you .aspx page where u want to create the Text Box and add the following code.



<ext:TextField ID="txtfield" runat="server">
        </ext:TextField>

The Below Code will create the page with label text as sample and a textfield.


<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server">
    </ext:ResourceManager>
    <div>
        <ext:Label ID="lblSample" runat="server" Text="Sample">
        </ext:Label>
        <ext:TextField ID="TextField1" runat="server">
        </ext:TextField>
    </div>
    </form>
</body>
</html>

Important points:
1. When Ever You create in asp.net you need to add the above code in Red Lines to Make compatible for the Ext.net to Work.
2.  <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
 this code makes the  Ext tags to work in current asp page.

3. Always a ResourceManager should be included after the form Tag.
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>



To Refresh the page from code behind using the following code:

Page.Response.Redirect(Page.Request.Url.ToString(), true);