if i click on login page the data should save in db through link for every registration a new link will be generate how to do it
the link should display in gridview once i click on the link it should display registered details... pls help me to solve.

Rajkiran SwainRank #165 · 14.4K reputationPosted Apr 5, 2023, 9:44 AM EDT
To achieve this, you can follow the following steps:
Create a database table to store the registration details. This table should have a primary key column that will be used to generate the unique link for each registration.
When a user submits the registration form, insert the data into the database table and generate a unique link for that registration using the primary key value. You can use a hash function to generate the link or use any other algorithm that guarantees uniqueness.
Store the link in the database along with the registration details.
Display the links in a GridView by fetching the data from the database table.
Create a new page that will display the registration details when the user clicks on the link. This page should read the registration data from the database based on the link value and display it to the user.
When the user clicks on a link in the GridView, redirect them to the new page passing the link value as a parameter.
Here is some sample code that demonstrates these steps:
// Step 1: Create a database table to store the registration details CREATE TABLE Registrations ( ID INT NOT NULL PRIMARY KEY IDENTITY(1,1), Name VARCHAR(50), Email VARCHAR(50), Phone VARCHAR(20), Link VARCHAR(50) ); // Step 2: Insert the registration data into the database and generate a unique link string name = "John Doe"; string email = "[email protected]"; string phone = "1234567890"; string link = GenerateLink(); // This function should generate a unique link string query = "INSERT INTO Registrations (Name, Email, Phone, Link) VALUES (@Name, @Email, @Phone, @Link)"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Name", name); command.Parameters.AddWithValue("@Email", email); command.Parameters.AddWithValue("@Phone", phone); command.Parameters.AddWithValue("@Link", link); connection.Open(); int rowsAffected = command.ExecuteNonQuery(); } // Step 4: Display the links in a GridView string query = "SELECT Link FROM Registrations"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(query, connection); SqlDataAdapter adapter = new SqlDataAdapter(command); DataTable table = new DataTable(); adapter.Fill(table); GridView1.DataSource = table; GridView1.DataBind(); } // Step 6: Redirect the user to the registration details page when they click on a link protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ViewDetails") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView1.Rows[index]; string link = row.Cells[0].Text; Response.Redirect("RegistrationDetails.aspx?Link=" + link); } } // Step 5: Display the registration details on the registration details page string link = Request.QueryString["Link"]; string query = "SELECT Name, Email, Phone FROM Registrations WHERE Link = @Link"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Link", link); connection.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { string name = reader["Name"].ToString(); string email = reader["Email"].ToString(); string phone = reader["Phone"].ToString(); // Display the registration details on the page } reader.Close(); }