Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
ASP.NET
<div style="margin-removed 480px">
        <asp:Label ID="Label1" runat="server" Text="First Name"></asp:Label>
    
            
        <asp:TextBox ID="txtfname" runat="server"></asp:TextBox>
                
        <br />
        <asp:Label ID="Label2" runat="server" Text="Last Name"></asp:Label>
    
            
        <asp:TextBox ID="txtlname" runat="server"></asp:TextBox>
 <br />
        <asp:Label ID="Label3" runat="server" Text="EmpId"></asp:Label>
    
                  
        <asp:TextBox ID="txtempid" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label4" runat="server" Text="D O B"></asp:Label>
    
                  
        <asp:TextBox ID="txtdob" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:Button ID="btnprev" runat="server" onclick="btnprev_Click" 
            Text="<< Prev" />
         
        <asp:Button ID="btnsave" runat="server" onclick="btnsave_Click" Text="Save" />
                 
        <asp:Button ID="btnnext" runat="server" onclick="btnnext_Click" 
            Text="Next >>" />
        <br />
        <br />
        <asp:Label ID="lblmsg" runat="server" Text=""></asp:Label>
    
    </div>

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;

public partial class _Default : System.Web.UI.Page
{
    DataTable dt;
    int i = 0;
    public void print()
    {
        DataRow dr = dt.Rows[i];
        txtfname.Text = dr[0].ToString();
        txtlname.Text = dr[1].ToString();
        txtempid.Text = dr[2].ToString();
        txtdob.Text = dr[3].ToString();
    
    
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        
     
     }
    protected void btnsave_Click(object sender, EventArgs e)
    {

        string connStr = WebConfigurationManager.ConnectionStrings["master"].ConnectionString;
       
        SqlConnection conn = new SqlConnection(connStr);
        conn.Open();
        SqlCommand cmd = new SqlCommand("insert into employee values('" + txtfname.Text + "','" + txtlname.Text + "','" + txtempid.Text + "','" + txtdob.Text + "')", conn);
        cmd.ExecuteNonQuery();
        conn.Close();
        lblmsg.Text = "Successfully Registered";

        
        

    }
    protected void btnprev_Click(object sender, EventArgs e)
    {
        i = 0;
        print();
    }
    protected void btnnext_Click(object sender, EventArgs e)
    {
        i = dt.Rows.Count - 1;
        print();

    }
}



HTML
<configuration>

	<connectionstrings>
		<add name="Northwind"
       connectionString="Data Source=JAGADEESHWAR;Initial Catalog=master;Integrated Security=True"
      providerName="System.Data.SqlClient"/>
	</connectionstrings>
	<system.web>
		<compilation debug="true" targetFramework="4.0"/>
		
	</system.web>
</configuration>



Hi Sir

I want to create web application like employee records save,prev,next using northwind connecttions string.


Thanks in advance.
Posted
Updated 27-Aug-12 20:53pm
v4
Comments
Vani Kulkarni 28-Aug-12 2:12am    
Ok do it. What have you tried? Where are you stuck?

1 solution

And what is the issue?

Based on what you say, looks like you need to have a gridview/datalist that has pagination and edit feature.
Start from here:
GridView all in one[^]
Inplace Edit in GridView[^]
MSDN: GridView.AllowPaging Property [^]

Read, Try out, post specific issue if you face.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900