Regular Expression for Website in Textbox in Asp.net using C#

Posted by Unknown On Tuesday, 19 March 2013 0 comments

<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Enter valid website URL" ControlToValidate="TextBox5" ValidationGroup="val1" ValidationExpression="(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"></asp:RegularExpressionValidator>
READ MORE

Regular Expression for Email ID in Textbox in Asp.net Using C#

Posted by Unknown On 0 comments

<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="Email Require" ControlToValidate="TextBox1" ValidationGroup="val1" Text="*"></asp:RequiredFieldValidator>
READ MORE
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Enter valid description" ControlToValidate="TextBox1" ValidationExpression="[0-9]+" ValidationGroup="val1"></asp:RegularExpressionValidator>
READ MORE

<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Enter valid description" ControlToValidate="TextBox1" ValidationExpression="[a-zA-Z ]+" ValidationGroup="val1"></asp:RegularExpressionValidator> 
READ MORE

Update Record in Gridview with Naming Container in Asp.net using c#

Posted by Unknown On 0 comments
First desing the page like following way


<table border="2">
        <tr>
            <td>
                <asp:Label ID="Label1" runat="server" Text="Product Name"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Product Name Required" Text="*" ControlToValidate="TextBox1" ValidationGroup="val1"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Enter valid product name" ControlToValidate="TextBox1" ValidationExpression="[a-zA-Z ]+" ValidationGroup="val1"></asp:RegularExpressionValidator>
            </td>
READ MORE

Delete in Gridview With DropdownListBox

Posted by Unknown On 0 comments
First Design The page take one Gridview.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
                        oncheckedchanged="CheckBox2_CheckedChanged" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Id">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
READ MORE

Delete in Gridview with CheckBox in Asp.net Using C#

Posted by Unknown On 5 comments
First Design The Page like following way take one Gridview and One Button for Delete

The Following is .aspx page design


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
                        oncheckedchanged="CheckBox2_CheckedChanged" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Id">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
READ MORE

Encrypt & Decreypt Password in Asp.net c#

Posted by Unknown On Monday, 18 March 2013 0 comments
First store the Password enter by user in string varible.
string encpass = enc_pass(TextBox6.Text);

Now enc_pass function is as follow...

 

READ MORE

Store procedure with multiple return value in Asp.net C#

Posted by Unknown On Friday, 15 March 2013 0 comments
First create procedure. . .

ALTER PROCEDURE dbo.user1
    @id int=0       
AS
           select * from user_reg where uid=@id;

           RETURN

READ MORE

Session create in Asp.net C#

Posted by Unknown On 0 comments
Write the following code in Button click event

 protected void Button1_Click(object sender, EventArgs e)
    {

        con.Open();
        SqlDataAdapter adp = new SqlDataAdapter("select * from com_register where uname='" + TextBox1.Text + "' AND pass='" + TextBox2.Text + "'", con);
        System.Data.DataTable dt = new DataTable();

READ MORE

Store Procedure with Return One Value in Asp.net c#

Posted by Unknown On 0 comments

First  create the procedur as follow. . .

ALTER PROCEDURE dbo.loginpro
     @email varchar(50),
    @pass varchar(50),
    @u_id int=0,
    @id int=null output
AS
      select @u_id=uid from user_reg where uemailid=@email and upass=@pass;
    set @id=@u_id
    RETURN @id


READ MORE

Nested GridView in ASp.net C#

Posted by Unknown On 1 comments
Following is the .aspx file code write this first. . .
<script type="text/javascript">
        function showNestedGridView(obj) {
            var nestedGridView = document.getElementById(obj);
            var imageID = document.getElementById('image' + obj);

            if (nestedGridView.style.display == "none") {
                nestedGridView.style.display = "inline";
                imageID.src = "minus.png";
            } else {
                nestedGridView.style.display = "none";
                imageID.src = "plus.png";
            }
        }
</script>
<br />
<br />
<br />
<center>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
        DataKeyNames="pid" ShowFooter="True"
        onrowdatabound="GridView1_RowDataBound"
        onrowcommand="GridView1_RowCommand">
        <Columns>

READ MORE

Display database data in Gridview in asp.net with c#

Posted by Unknown On Friday, 8 March 2013 0 comments

First of all you have to create sql connection with the database...
            For this see the following link


now use the following code for gridview bind in button click event...

protected void Button1_Click(object sender, EventArgs e)
    {
               con.open();
               SqlDataAdapter adp=new SqlDataAdapter("Select * from Emp",con);
               DataTable dt=new DataTable();
               adp.Fill(dt);
                GridView1.DataSource=dt;
                 GridView1.Databind();
    }

READ MORE