My first Page :
.aspx
<asp:GridView ID="GridView1" runat="server" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3"
CssClass="grdDataGrid" Height="102px" onrowdatabound="GridView1_RowDataBound">
<RowStyle ForeColor="#000066" /> <FooterStyle BackColor="White" ForeColor="#000066" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
code behind
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var firstCell = e.Row.Cells[0];
firstCell.Controls.Clear();
firstCell.Controls.Add(new HyperLink { NavigateUrl = "ser_job_status1.aspx?Complaint_No = " + firstCell.Text, Text = firstCell.Text, Target = "_blank" });
Session["Complaint_No"] = firstCell.Text;
//////Session["Complaint_No"] = GridView1.Rows[e.RowIndex].Cells[HyperLink(NavigateUrl)].Value.ToString();
}
}
GridView1.DataBind();
My second page :
protected void Page_Load(object sender, EventArgs e)
{
string strComplaintNo = Convert.ToString(Session["Complaint_No"]);
TextBox51.Text = strComplaintNo;
}
My Question is since i have use Hyperlink before Binding Datasource to Gridview my firstCell.
Text value holds last fetched data.
So if i click on that link my sessoin get the value of firstCell.
Text which is inturn last fetched value.. But my requirement is to fetch the hyperlinked value..
can anyone help me to solve this issue
I have used C# as my code behind...