Wednesday, November 28, 2012

Jquery Alert Box

As you can see in the below script, i just have added a jquery plug-in to my application for jquery classes.The jquery /Javascript provides alert box to display the desired data on dialog box.
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js></script>
<script type="text/javascript">
    $(document).ready(function () {
        alert('Jquery Alert Box');
    });
</script>
<html>
<head><title>Jquery Alert</title></head>
<body>
</body>
</html>
you can excute the script by the time of page using Doument.ready function

String to DataTable in asp.net using C#.Net

Title:How to bind data table using string array in asp.net using c#

Description:
We have already learnt data binding to data source controls.Now i would like to show how would we use the array list to bind the data to grid view etc.

Examples:
Some  examples for JQuery Auto complete text box, how to bind or Export CSV data to data table in asp.net.The below example describes the logic of iteration of array list to  data table.In the below i have used a string array to hold the string data and a grid view to display the resultant data of Data table.
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:GridView ID="GvOrdr" runat="server"></asp:GridView>
</asp:Content>

DataTable dtOrdrName = new DataTable();
dtOrdrName.Columns.Add(new DataColumn("Name", typeof(string)));
string[] strSplitOp = new string[] { "bhaskar", "Siva", "Ram" };
for (int i = 0; i <= strSplitOp.Length - 1; i++)
{
DataRow NewDrow = dtOrdrName.NewRow();
NewDrow["Name"] = strSplitOp[i].ToString();
dtOrdrName.Rows.Add(NewDrow);
}
GvOrdr.DataSource = dtOrdrName;
GvOrdr.DataBind();

Saturday, November 24, 2012

UniqueId and ClientID in asp.net

Here i have given two scenarios to explain those importance in asp.net
In case of a control which is placed in a web form without Master Page:
The Id and Name attribute rendered to the browser are same as Id of control on server and thus the same Id/Name can be used

for programming a control in java script

In case of a control which is placed in a web form with Master Page:

The control Client side Id="<%=ServerofControl.ClientID%>" example:ct100_ContentPlaceHolderId_ServerIdofControl

The control Client side Name="<%=ServerofControl.UniqueID%>" example:ct100$ContentPlaceHolderId$ServerIdofControl

1.Add a text box and HTML button to webform/content page which has been page
<asp:TextBox runat="server" ID="txtwform"/>

<input type="button" value="cbutton" onclick="Show()"/>

2.Add the following to the web form (cphHead isId of ContentPaveHolder added to Head Section of Master Page)
<asp:Content ID="chead" ContentPlaceHolderID="cphead" runat="server">

<script>
function Show()
{
var test=document.<%=Page.Form.ame%>.<%=txtwform.UniqueID%>;
alert(test.value);
}
</scrip>

Thursday, November 22, 2012

How to create object reference in Wpf

The creation of object reference in wpf will be easy when we compare with previous version of XAML.In previous versions we have to declare and binding Element name .In updated XAML we can used X:Reference to create object reference
<Label Target="{Binding ElementName=OId}">OrderId</Label>
<TextBox x:Name="Oid" />

 updated version:
<Label Target="{x:Reference Oid}">OrderId</Label>
<TextBox x:Name="Oid" />
<Label Target="{x:Reference Oname}">OrderName</Label>
<TextBox x:Name="Oname" />
<Label Target="{x:Reference Oslaes}">Sales</Label>
<TextBox x:Name="Osales" />
 
Note:The XAML X:Reference can supported in WPF frame work.In  XAML 2006 we have to use binding to reference the object
 

Wednesday, November 21, 2012

Difference between literal and label control in asp.net

Most of you confused when work these control.Because both controls are used to display the text.But there are some difference between those controls .
Main Difference:
Label control will display text in span tag .So we can apply styles to it.But literal control rendered out only text.Here i will show an example for how they behave in application



Bel