Feeds:
Posts
Comments

In this session we can discuss about the how to add the user created DLL from your application, We already discuss the how to convert the class (.cs) to DLL, after create the DLL you have a problem how to add your DLL in to the required application, Its very simple…………..

How to make the class(.cs) to DLL

First you have to add the DLL in your application

Clik  website->Add reference->choose browse tab(you can access the path where you save the DLL)

That it you will add your DLL in your application… next we have to discuss how to access the DLL method in your app..

First add the namespace of the DLL using classdll;

Second declare the DLL class inside or outside the page load

Class1 callcls=new Class1();

Third using the class object call the method..

Long var=callcls.Add(12);//Add will be one of the method will used in your DLL

Response.Write(value);

Ok that fine now you can create the DLL file and Add the DLL into your application then access the DLL method also, I hope you will enjoy this session…..

Hi guys this session we have to discuss how to create the DLL (Dynamic link libraries) file from class (.cs), for this I was search and find out the solution it was quite easy to understand, first why we are using DLL instead class (.cs) , the only reason is security when we convert .cs file to dll no one can see through your coding….

How to make class(.cs) file into dll

1. In Microsoft visual studio file->new->project
2. choose project type as c# and template will be class libraries
3. the project name was classdll
4. check the classdll location in your hard disk, there is one folder name was bin->debug-> here only your class file will convert into dll
5.your file name was class1.cs
6.first add your libraries whatever you want
7. it show the error (missing assembly reference) you have to add the some libraries move to
Project->addreference->.net(tab) add your dll files…

8. your class file will be
namespace classdll
{
public class Class1
{
}
}
A
bove like this
9.you can placed your .cs coding in the class1 method
public class Class1
{
public long Add(long val1)//don’t give the static method
{
return val1;
}
}

Now you have to check the file have error or not,if any error not found just run the class file..the dll file will be created in the bin folder…

Above are the procedure to create the class(.cs) file into DLL, I hope you will enjoy this session…..

Hello Everyone in this Session we can discuss about the calling the postback from java script , In asp.net For every control there is lot of option is there, for example in my program label is there and html textbox is there when I change the content of text box(keyup) have to change the content of label, When change the content in textbox calling a javascript file from that it will fire the postback event

In Java Script

<script language=”javascript”>

function call_scrpt()
{

__doPostBack(“<%=lbt.ClientID %>”);
}
</script>

The lbt is the id of the label will placed in the updatepanel…. doPostBack will get the id and moved to codebehind page.
Design Page

<asp:ScriptManager ID=”ScriptManager1″ runat=”server”>

</asp:ScriptManager>

<asp:UpdatePanel ID=”UpdatePanel1″ runat=”server”>

<ContentTemplate>

<asp:Label ID=”lbt” Text=”Intial Text” runat=”server” />

</ContentTemplate>

</asp:UpdatePanel>

<input type=”text” id=”t1″ value=”gowri” onkeyup=”JavaScript:call_scrpt();” />

In Html input call the java script file during the onkeyup function……

Code behind:
if (ScriptManager1.IsInAsyncPostBack)
{
lbt.Text = “ajax is working”;
}

Above coding will be placed in the page load, I hope this will help you for postback option in javascript.

Hi Guys in this session we can discuss about the how to display the data (data from database), it was quite easy to get the data for that declare the sqlconnection, sqldatareader and sqlcommand. In sqlconnection declare the connection string. In sqlcommand we can declare the sql command, the sqlcommand execute by the help of sqldatareader.

Header file

Before going to that first declare the header file, because we can access the sql.

using System.Data.SqlClient;

Now we are going to example program to explain how to display the data from database. For example we have country table in that country short name and full name there, if u click the short name in dropdownlist box the corresponding full will be appear in the another label

Coding in Design Page

<asp:DropDownList ID=”DropDownList1″ runat=”server” AutoPostBack=”True” DataSourceID=”SqlDataSource1″ DataTextField=”shortname” DataValueField=”shortname”></asp:DropDownList>

<asp:SqlDataSource ID=”SqlDataSource1″ runat=”server” ConnectionString=”<%$ ConnectionStrings:signquickonline %>”SelectCommand=”SELECT [shortname], [fullname] FROM [countries]“></asp:SqlDataSource>

<asp:GridView ID=”GridView1″ runat=”server”></asp:GridView>

<asp:Label ID=”ldisplay” runat=”server” />;

In Code behind

SqlConnection mycn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["signquickonline"].ConnectionString);

SqlDataReader dataReader = null;

mycn.Open();

SqlCommand cmd = new SqlCommand();

cmd.CommandText = (“SELECT [fullname] FROM [sign].[dbo].[countries] where [shortname]=’” + DropDownList1.SelectedValue.ToString() +”‘”);

cmd.Connection = mycn;

dataReader = cmd.ExecuteReader();

if (dataReader.HasRows) { while (dataReader.Read())

{

ldisplay.Text = dataReader["fullname"].ToString();

}

}

Place the coding in the page load event. here have the single output we can display in the label. Suppose we have multiple set of output what we can do? But still there is a chance declare the datalist or gridview in design page and access the datatable and datarow in the coding page.

Samplecoding

Add the gridview in design page

In Code behind

After execute the command(dataReader = cmd.ExecuteReader();)

Declare the datatable and datarow

DataTable objDT = new DataTable(“RVI”);

objDT.Columns.Add(new DataColumn(“name”, typeof(String)));

DataRow objDR;

if (dataReader.HasRows)

{

while (dataReader.Read())

{

objDR = objDT.NewRow();

objDR["name"] = dataReader["fullname"].ToString();

objDT.Rows.Add(objDR);

GridView1.DataSource = objDT.DefaultView;

GridView1.DataBind();

}

}

I hope you will enjoy this session.

Hello guys sorry for the long days, in this session we can discuss about the how to insert the data in sql server using Asp.net.
In sql server:
The table name will be materials_details in that two fields are there first one was sign_material_id and Sign_material_name.
In asp.net
Declare the two textbox and one button when u click the button the value will be insert into the text box.
<asp:TextBox ID="tid" runat="server" /><br />
<asp:TextBox ID="tname" runat="server" />
<asp:Button ID="clkbutton" OnClick="btn_clicked" runat="server"
Text="click here" />

When u click the button the corresponding method will be fire,in that btn_clicked method you call the sqldatasource insert process

For example

protected void btn_clicked(object sender, EventArgs e)
{
inser_data.Insert();
}

The insert_data was name of the sqldatasource name in that datasource u have to give the connection string and what type command you have to perform like insert or update.here we can insert the data so you can use the insertcommand
In that you write your insert command same as sql server and below you choose the insertparameter in that above textbox name will be control id and the name will be given to insert command.

sqldatasource

<asp:SqlDataSource ID="inser_data" runat="server" ConnectionString="<%$ ConnectionStrings:con1 %>" InsertCommand="INSERT INTO [materials_details] ([sign_material_id],[sign_material_name]) VALUES (@id,@nme)" >
<InsertParameters>
<asp:ControlParameter ControlID="tid" Type="String" Name="id" />
<asp:ControlParameter ControlID="tname" Type="String" Name="nme" />
</InsertParameters>
</asp:SqlDataSource>

In this session we can discuss about the sleep or wait in javascript, In generally no sleep or wait method are there but we set a timer when the time expire the function will be executed. Using setTimeout method we can proceed the sleep or wait process.
Sample Coding:

In design page
You just declare the button, when the button clicked alert box will appear after some time only.
<asp:Button ID="Button1" Text="Clck" runat="server" OnClientClick="JavaScript:txtchnge();" />
If you click the button, that will fire the javascript function.

JavaScript

function txtchnge()
{
setTimeout(“alert(‘hello’)”,5000);
}

When the javascript function fired after few time alert box will appear, I hope you will enjoy this session.

In this session we discuss about the validation in ajax asp.net, In my blog we already discuss about the validator in Asp.net, now we discuss about how to implement the Asp.net validator to ajax. In ajax we have ValidatorCalloutExtender used for enhances the functionality of existing ASP.NET validators.
Sample coding:
<asp:TextBox ID="name" runat="server" />
<asp:RequiredFieldValidator ID="rname" ControlToValidate="name" runat="server" ValidationGroup="fg" Display="None" ErrorMessage="enter the name" />
<ajaxToolkit:ValidatorCalloutExtender ID="ajid" TargetControlID="rname" runat="server" />

Here validatorcallout targertcontrol id will take the id of requirefieldvalidator and display will be none
<asp:TextBox ID="email" runat="server" />
<asp:RegularExpressionValidator ID="em1" ControlToValidate="email" ErrorMessage="Enter the correct email" Display="None" ValidationGroup="fg" runat="server" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"/>
<ajaxToolkit:ValidatorCalloutExtender ID="ajem" TargetControlID="em1" runat="server" />

Set the id of regularexpressionvalidator to target id of validatorcallout.
<asp:Button ID="bt" Text="click here" runat="server" ValidationGroup="fg" />
That’s it! Now you are going to validate your form with ajax validator.
I hope you will enjoy this session if you want to know some oyher validation in ASP.NET click here

In this session we discuss about the how to call the JavaScript when I click the button in Asp.net application. JavaScript was designed to add interactivity to HTML pages. In our application I have a button and label, during button click the label text will change and alert will display using the JavaScript, how it’s possible in Asp.net, generally script tag can be placed head or body section in your html coding.
JavaScript:
<script type="text/javascript">
function btclk()
{
alert("button clicked");
}
</script>

Above coding will be placed in head tag, whenever btclk() function triggered the alert box will appear.
Design Page:
<asp:Label ID="lbl" runat="server" />
<asp:Button ID="bt" runat="server" Text="click here" OnClick="bt_cked" OnClientClick="javascript:btclk();" />

onclick will be call the code behind method and onclientclick method call the JavaScript method.
Code Behind;
protected void bt_cked(object obj, EventArgs e)
{
lbl.Text = “U Click Your Button”;
}
This is very simple coding to understand how to call the javaScript function.

In this post we can discuss about the ASP.NET validator, generally validation will be used for when you are filling the form, compare to other language ASP.NET very simplify in validation function. Below list is important validator in ASP.NET.
1. RequiredFieldValidator
2. RegularExpressionValidator
3. CompareValidator
4. RangeValidator

RequiredFieldValidator
It will check the whether the user give the input value or not.
<asp:TextBox ID="tnme" runat="server" />
<asp:RequiredFieldValidator ID="r1" ControlToValidate="tnme" runat="server" ErrorMessage="Enter the name" ValidationGroup="grp" Display="Dynamic" />

In a single form we use multiple textbox for that we make a group, you have to assign the group name.

RegularExpressionValidator
It will check the user input will correct format like postal code, phone number and email id etc.
<asp:TextBox ID="email" runat="server" />
<asp:RegularExpressionValidator ID="r3" ControlToValidate="email" runat="server" ValidationGroup="grp" Display="Dynamic" ErrorMessage="Enter the valid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />


Note :validation expression will your choice, you can choose postal code, phone number and email id etc.

CompareValidator
The compare validator will be used for when the user fill the password and conform password box, it will show the confirmation of password match or not.
<asp:CompareValidator ID="cv" ControlToCompare="tp" ControlToValidate="tcp" ErrorMessage="your password and confirm password not match" Display="Dynamic" runat="server" />

RangeValidator
The rangevalidator will be check the user input value within the range.
<asp:RangeValidator ID="rtenum" ControlToValidate="tenum" MinimumValue="1" MaximumValue="9" ErrorMessage="enter the number 1 to 9" runat="server" Type="Integer" />
Note:In rangevalidator you have to specify the type of the range.

Sample Coding

<table>
<tr>
<td>UserName</td>
<td>
<asp:TextBox ID="tnme" runat="server" />
<asp:RequiredFieldValidator ID="r1" ControlToValidate="tnme" runat="server" ErrorMessage="Enter the name" ValidationGroup="grp" Display="Dynamic" />
</td>
</tr>
<tr>
<td>Email</td>
<td>
<asp:TextBox ID="email" runat="server" />
<asp:RequiredFieldValidator ID="r2" ControlToValidate="email" runat="server" ErrorMessage="Enter the email" ValidationGroup="grp" Display="Dynamic" />
<asp:RegularExpressionValidator ID="r3" ControlToValidate="email" runat="server" ValidationGroup="grp" Display="Dynamic" ErrorMessage="Enter the valid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />
</td>
</tr>
<tr>
<td>Password</td>
<td>
<asp:TextBox ID="tp" runat="server" />
<asp:RequiredFieldValidator ID="prf" ControlToValidate="tp" ErrorMessage="Enter the password" ValidationGroup="grp" Display="Dynamic" runat="server" />
</td>
</tr>
<tr>
<td>Confirm Password</td>
<td>
<asp:TextBox ID="tcp" runat="server" />
<asp:RequiredFieldValidator ID="cprf" ControlToValidate="tcp" ValidationGroup="grp" ErrorMessage="enter the confirm password" Display="Dynamic" runat="server" />
</td>
</tr>
<tr>
<td>Enter the number</td>
<td>
<asp:TextBox ID="tenum" runat="server" />
<asp:RangeValidator ID="rtenum" ControlToValidate="tenum" MinimumValue="1" MaximumValue="9" ErrorMessage="enter the number 1 to 9" runat="server" Type="Integer" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:CompareValidator ID="cv" ControlToCompare="tp" ControlToValidate="tcp" ErrorMessage="your password and confirm password not match" Display="Dynamic" runat="server" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="bt" runat="server" ValidationGroup="grp" Text="submit" />
</td>
</tr>
</table>
I hope you will enjoy this session if you want to know validation in ajax click here

Here we can discuss about the confirm button extender in ajax toolkit and it’s been an introduction for using toolkit. First we want known about the confirm button action, in java script we use the alert message box it`s like when we click the button the message box will appear.
For example:
In my application one link button is there if I click the link button the page navigate to the another page, during that time I need a one alert box the message will be whether you want to navigate or not let see the sample coding.
Sample Coding

<asp:LinkButton ID="bt1" Text="navigation" PostBackUrl="~/Default.aspx" runat="server" />
First we declare the link button if u click the button page will be redirect into default page,now we implement the ajax toolkit confirmbutton action.
ajaxtoolkit confirmbutton extender

<ajaxToolkit:ConfirmButtonExtender ID="cc2" ConfirmText="are you want to navigate" TargetControlID="bt1" runat="server" />
Above are the coding to include the confirmbutton, I hope it will give you clear idea about ajaxtoolkit confirmbutton extender.

Older Posts »