Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Login page when edit clicked in Gridview

Login page when edit clicked in Gridview

Scheduled Pinned Locked Moved ASP.NET
helpquestion
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    demouser743
    wrote on last edited by
    #1

    Hi all i need a small help regarding gridview. I will show some information on loading a page. When ever a user clicks on Edit or delete it should redirect to a login page. Only the login user can edit or delete the data. How can i do this.

    N D 2 Replies Last reply
    0
    • D demouser743

      Hi all i need a small help regarding gridview. I will show some information on loading a page. When ever a user clicks on Edit or delete it should redirect to a login page. Only the login user can edit or delete the data. How can i do this.

      N Offline
      N Offline
      nagendrathecoder
      wrote on last edited by
      #2

      By checking whether user is logged in or not on edit & delete click. :^)

      D 1 Reply Last reply
      0
      • N nagendrathecoder

        By checking whether user is logged in or not on edit & delete click. :^)

        D Offline
        D Offline
        demouser743
        wrote on last edited by
        #3

        Can i have the sample code

        N S 2 Replies Last reply
        0
        • D demouser743

          Can i have the sample code

          N Offline
          N Offline
          nagendrathecoder
          wrote on last edited by
          #4

          Sure, but first tell me, what are you doing for Login functionality?

          D 1 Reply Last reply
          0
          • D demouser743

            Can i have the sample code

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            Are You Using Sessions or forms authentication..!

            LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

            1 Reply Last reply
            0
            • N nagendrathecoder

              Sure, but first tell me, what are you doing for Login functionality?

              D Offline
              D Offline
              demouser743
              wrote on last edited by
              #6

              Just a basic login like this protected void Button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["sqlcon"]); SqlCommand cmd = new SqlCommand(); cmd.Connection = Con; string sql; sql = "Select *from login where uname='" + TextBox1.Text + "' and pwd='" + TextBox2.Text + "'"; cmd.CommandText = sql; Con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Response.Redirect("Default.aspx"); } }

              N S 2 Replies Last reply
              0
              • D demouser743

                Just a basic login like this protected void Button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["sqlcon"]); SqlCommand cmd = new SqlCommand(); cmd.Connection = Con; string sql; sql = "Select *from login where uname='" + TextBox1.Text + "' and pwd='" + TextBox2.Text + "'"; cmd.CommandText = sql; Con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Response.Redirect("Default.aspx"); } }

                N Offline
                N Offline
                nagendrathecoder
                wrote on last edited by
                #7

                This is not a proper Login. You need to use either Session Variables or FormsAuthentication Class. For more details, please use Google.

                1 Reply Last reply
                0
                • D demouser743

                  Just a basic login like this protected void Button1_Click(object sender, EventArgs e) { SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["sqlcon"]); SqlCommand cmd = new SqlCommand(); cmd.Connection = Con; string sql; sql = "Select *from login where uname='" + TextBox1.Text + "' and pwd='" + TextBox2.Text + "'"; cmd.CommandText = sql; Con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Response.Redirect("Default.aspx"); } }

                  S Offline
                  S Offline
                  sashidhar
                  wrote on last edited by
                  #8

                  OH Great..! First Try to read a good book..! Did You Know abt forms authentication..!First try to read abt forms authentication..!

                  check the
                  protected void ConfirmDataGrid_ItemCommand(object sender, DataGridCommandEventArgs e)
                  {
                  if (e.CommandName ="edit")
                  {
                  //Write Your Logic Here if the user is Login user
                  //If the user is not logged in Redirect From here..!

                    }
                  
                   }
                  

                  LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                  1 Reply Last reply
                  0
                  • D demouser743

                    Hi all i need a small help regarding gridview. I will show some information on loading a page. When ever a user clicks on Edit or delete it should redirect to a login page. Only the login user can edit or delete the data. How can i do this.

                    D Offline
                    D Offline
                    demouser743
                    wrote on last edited by
                    #9

                    Hey i just write it for sample. I know form authentication and other . Please provide me what to do after log in success.

                    D 1 Reply Last reply
                    0
                    • D demouser743

                      Hey i just write it for sample. I know form authentication and other . Please provide me what to do after log in success.

                      D Offline
                      D Offline
                      demouser743
                      wrote on last edited by
                      #10

                      using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["Loginerrors"] = 0; } } private bool validate(String Uname, String Pwd) { bool val = false; SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["sqlcon"].ToString()); string qry = "Select Uname, Pwd FROM login"; SqlCommand cmd = new SqlCommand(qry, con); SqlDataReader dr; con.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { if ((Uname == dr["Uname"].ToString()) & (Pwd == dr["Pwd"].ToString())) { val = true; } dr.Close(); return val; } return val; } protected void Login1_Authenticate(object sender, EventArgs e) { if (validate(Login1.UserName,Login1.Password)) { Login1.Visible = false; Label1.Text = "Success"; } else { Label1.Text = "Failed"; } } } Is this code efficient for login

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups