I am having troble displaying relevant information for a clicked hyperlink .
I have a table "Course" and "StudentInfo"
My Hyperlinks display list courses from DB* table(Course.table) and when I click one Hyperlink, the program has to get information for that link clicked from database
and display whether in a gridview or label (It has to check which hyperlink is clicked i guess)
this is how I display my hyperlinks from DB*
<asp:gridview id="mygv"
autogeneratecolumns="false"
runat="server">
<columns>
<asp:hyperlinkfield datatextfield="hyperlink"
datatextformatstring="{0:c}"
datanavigateurlfields="hyperlink"
datanavigateurlformatstring="~\WebForm1.aspx?hyperlink={0}"
headertext=""
/>
</columns>
</asp:gridview>
if (!IsPostBack)
{
BindGrid(mygv);
}
try
{
SqlCommand cmd = new SqlCommand(" SELECT [hyperlink] FROM Courses WHERE [Student ID] = '" + Session["StudentID"] + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
mygv.DataSource = dr;
mygv.DataBind();
}
else
{
mygv.DataSource = null;
mygv.DataBind();
}
}
catch (Exception ex)
{
Response.Write("Error Occured: " + ex.ToString());
}
finally
{
con.Close();
}
how do I get the information for the link clicked??