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

Follow

Get every new post delivered to your Inbox.