<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
ErrorMessage="Enter
valid website URL" ControlToValidate="TextBox5" ValidationGroup="val1" ValidationExpression="(http|https)://([\w-]+\.)+[\w-]+(/[\w-
./?%&=]*)?"></asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server"
ErrorMessage="Email
Require" ControlToValidate="TextBox1" ValidationGroup="val1" Text="*"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ErrorMessage="Enter
valid description" ControlToValidate="TextBox1" ValidationExpression="[0-9]+" ValidationGroup="val1"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ErrorMessage="Enter
valid description" ControlToValidate="TextBox1" ValidationExpression="[a-zA-Z ]+" ValidationGroup="val1"></asp:RegularExpressionValidator>
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>
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>
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>
First store the Password enter by user in string varible.
string encpass = enc_pass(TextBox6.Text);
Now enc_pass function is as follow...
First create procedure. . .
ALTER PROCEDURE dbo.user1
@id int=0
AS
select * from user_reg where uid=@id;
RETURN
ALTER PROCEDURE dbo.user1
@id int=0
AS
select * from user_reg where uid=@id;
RETURN
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();
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();
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
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>
<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>
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();
}