Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
 
<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>
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();
 
    }
}
 

<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 27-Aug-12 21:09pm
Edited 27-Aug-12 21:53pm
v4
Comments
Vani Kulkarni at 28-Aug-12 2:12am
   
Ok do it. What have you tried? Where are you stuck?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 DamithSL 365
1 Maciej Los 232
2 OriginalGriff 213
3 BillWoodruff 79
4 Jose Garcia Sevilla 75
0 OriginalGriff 7,953
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,454
3 Maciej Los 5,293
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 28 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100