Wednesday 11 July 2012

FormView

FormView

<NameSpace>
System.Web.UI.WebControls

<Properties>
BackColor:
BackImageUrl:
ClientID:
Context: Gets the HttpContext
DataItem: Gets the data item bound to the FormView control
DataKey:
DataSource: gets or sets the object from which the formview retrieves its list of data items
Page: gets a reference to the Page instance
PagerStyle:

<Methods>
BuildProfileTree:
CreateTable: creates the containing table for the FormView control
DeleteItem: deletes the current record in the FormView
FindControl(String): searches the current naming container for a server control

<Events>
Init
ItemCreated()
ItemDeleted()

Friday 15 June 2012

DetailsView Class

<Description>
Displays the values of a single record from a data source in a table, where each data row represents a field of the record. The DetailsView control allows you to edit, delete, and insert record

<Properties>
AllowPaging: gets or sets a value indicating whether the paging feature is enabled
AutoGenerateRows : gets or sets a value indicating whether row fields for each field in the data source are automatically generated and displayed in a DetailsView control.
Caption: gets or sets the text to render in an HTML caption element in a DetailsView control.
DataSource: gets or sets the object from which the data-bound control retrieves its list of data items
HeaderRow: gets a DetailsViewRow object that represents the header row in a DetailsView control
Page:
PageCount:

<Method>
CreateFieldSet
CreateRow
CreateTable:
DataBind:
OnPreRender:
OnUnload:
Render:
SaveControlState:
SaveViewState:
UpdateItem: updates the current record in the data source

<Events>
DataBinding:
Init:
ItemCommand:
ItemUpdated:
ItemInserted:
ItemDeleted:

<Example>
The following code example demonstrates how to use a DetailsView control in combination with a GridView control for a simple master-detail scenario.



<table>
        <tr>
        <td>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" 
                DataSourceID="Customers"
                DataKeyNames="CustomerID">
                <Columns>
                    <asp:CommandField ShowSelectButton="true" />
                    <asp:BoundField DataField="ContactName" HeaderText="ContactName" />
                    <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" />
                </Columns>
            </asp:GridView>
        </td>


        <td valign="top">
            <asp:DetailsView ID="DetailsView1" runat="server"
                AutoGenerateRows="true" DataKeyNames="CustomerID"
                DataSourceID="Details" Height="50px" Width="301px">
                </asp:DetailsView>
        </td>
        
        </tr>
        </table>



<asp:SqlDataSource ID="Details" runat="server"
            ConnectionString="<%$ ConnectionStrings:MOConnectionString %>"
            SelectCommand ="select * from tblMOTest where CustomerID = @CustomerID">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="CustomerID"
                    PropertyName="SelectedValue"
                    type="String" />
            </SelectParameters>
        </asp:SqlDataSource>



<asp:SqlDataSource ID="Customers" runat="server"
            ConnectionString="<%$ ConnectionStrings:MOConnectionString %>"
            SelectCommand ="select CompanyName, ContactName, CustomerID from tblMOTest ">
        </asp:SqlDataSource>




select CompanyName, ContactName, CustomerID from Customers
select * from Customers where CustomerID = @CustomerID

<Example2>





Sunday 27 May 2012

ClientFormsIdentity

<Namespace>
System.web.ClientServices

<Constructors>
<Properties>
AuthenicationCookies: Gets a collection of the cookies retrieved from the authenication service
IsAuthencated: Gets a value indicating whether the user has been authenticated

<Methods>
RevalidateUser: Silently authenticates the user by using cached credentials.

<the namespace System.Web.ClientServices>
The System.Web.ClientServices namespace provides classes that support acess in Windowes-based application to the ASP.NET Ajax authentication, roles, and profiles services.

The ConnectivitySatus class enables you to store the status of the user's network connection in the lcoal data cache. The connectivity status indicates whether the client service providers will use the offline cache or attempt to acess the application services.


A code project ariticle talks about 'Client Application Services' in visual studio 2008.



Sunday 6 May 2012

Cache

Namespace: System.Web.Caching

<Properties>
Count: Gets the number of items stored in the cache
EffectivePercentagePhysicalMemoryLimit:
Item: Gets or sets the cache item at the specified key

<Methods>
Add: adds the specified item to the Cache object with dependencies, expiration and priority policies
Get: retrieves the specified item from the Cache object
GetHashCode: Serves as a hash function for a particular type.
Insert(String, Object): inserts an item into the Cache object with a cache key




To use the CacheItemRemovedCallback delegate, you must add an item to the cache with this method, so that ASP.NET can automatically make the proper method calls when the item is removed. (look at red under line in above picture).

<Cache vs Session Variables>


Cache is application specific and Session is user specific.
eg. If you have a cache object say Cache["abc"], then this value is available to all the user logged in to the site.
Cache["abc"]= "website cache";
User A reads its value as "website cache"
User B reads its value as "website cache"
But if you have session variable, then each user has its own copy of Session.
eg. User A --> Session["UserName"]= "Mr. XYZ";
User B --> Session["UserName"]="Mr. ABC"; 

AuthenticationService Class

Enables access to ASP.NET forms authentication as a web service.

The AuthenticationService type exposes the following members
<Methods>
IsLoggedIn: Determines whether the current user is authenticated.
Login: Checks user credentials and creates an authentication ticket (cookie) if he credentials are valid
ValidateUser: Autheiticate user credentials without issuing an authentication ticket.

<Events>
Authenticating: occurs when user credentials are being validated
CreatingCookie: occurs when the authentication cookie is being set


Sunday 29 April 2012

AJAX Accordion Control

I couldn't see accordion control from the tool box.


You need add to this.
Mouse right button on toolbox => Add Tab => Chooose Items.. => .NET Framework componemts => Browse button => select AjaxControlToolkit.dll (this dll file you have to find on Internet, probably from http://ajaxcontroltoolkit.codeplex.com/)


Then you will see the accordion contols. From here look up youtube to find 'how to use accordion control' and you can add some controls. For me, when coding, the compiler asked me to use TookkitScriptManager instead of standard ScriptManager control.


Part of my code is here.



    <%--<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>--%>
        <ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </ajax:ToolkitScriptManager>


    <asp:UpdatePanel ID="updatepanel1" runat="server">
    <ContentTemplate>
 
    <ajax:Accordion ID="Accordion1" runat="server" SelectedIndex="0" FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250" AutoSize="None" >
        <Panes>
        <ajax:AccordionPane ID="AccordionPane1" runat="server">
            <Header>
                <a href="" onclick="return false;" >Section1</a>
            </Header>
            <Content>
                <asp:TextBox ID="tbRes1" runat="server"></asp:TextBox>
                <asp:Button ID="btnSection1" runat="server" Text="Button" />
            </Content>
            ...


And it looks like this.