请教:linkbutton传值接值问题
传值页面代码:
protected void lkb_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
string typeID = lb.CommandArgument.ToString().Trim();
int Row = ((GridViewRow)lb.Parent.Parent).RowIndex;
string user = GV1.Rows[Row].Cells[0].Text.ToString().Trim();
string lnk = "products/spot.aspx? eid=" + typeID;
Response.Redirect(lnk);
}
接值页面代码:
public partial class products_spot : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ListBind();
string id = "";
if (Request.QueryString["eid"] != null)
{
id = Request.QueryString["eid"].ToString();
SqlConnection sqlcon = new SqlConnection();
SqlDataAdapter sda;
DataSet ds = new DataSet();
string sqlconstr = "Data Source=***;Initial Catalog=***;User ID=sa;Password=***";
sqlcon.ConnectionString = sqlconstr;
string sqlcmd = "SELECT spot.* FROM spot WHERE (typeID like " + id + ")";
using (sda = new SqlDataAdapter(sqlcmd, sqlcon))
{
try
{
sda.Fill(ds, "product");
Session["ds"] = ds;
}
catch (TimeoutException ex)
{
Response.Write(ex.Message.ToString());
}
}
gv1.DataSource = ds.Tables["product"].DefaultView;
gv1.DataBind();
DL2.DataSource = ds.Tables["product"].DefaultView;
DL2.DataBind();
DL3.DataSource = ds.Tables["product"].DefaultView;
DL3.DataBind();
}
else { return; }
}
}
......
问题是:gv1、DL2、DL3没有数据显示。click后地址网有看到要传的值(...eid=typeID).而在本页内linkbutton传的值可以查询到数据(gv1、DL2、DL3有正确的数据显示出)。请行家帮忙查查原因,先谢了。