thank u!!!
PASSING GRIDVIEW VALUES
how to pass the selected gridview row values which is in Default.aspx to another gridview which is in another page(Default2.aspx) ???
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Mar 19, 2013, 6:13 AM
using System;
using System.Collections;
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;
namespace Show_data_on_a_next_form
{
public partial class test3 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindgrid();
}
}
private void bindgrid()
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
SqlDataReader reader;
reader = com.ExecuteReader();
g1.DataSource = reader;
g1.DataBind();
con.Close();
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test4.aspx.cs" Inherits="Show_data_on_a_next_form.test4" %>
using System;
using System.Collections;
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;
namespace Show_data_on_a_next_form
{
public partial class test4 : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
string s1;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
try
{
con.Open();
s1 = Request.QueryString[0];
str = "select * from employee where empid='" + s1 + "'";
com = new SqlCommand(str, con);
g2.DataSource = com.ExecuteReader();
g2.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
con.Close();
}
}
}
AbhiPriya M VPosted Mar 21, 2013, 12:34 AM
thank u!!!!
AbhiPriya M VPosted Mar 19, 2013, 12:58 AM
Vishal GilbilePosted Mar 18, 2013, 6:40 AM
It simple again you have to make use of GridView selected index changing event.
Simply redirect to default2.aspx page by passing the values as query string.
For instance.
Hope that solves your problem
With Regards,
Vishal Gilbile.