Hello. I need help...
I have two tables which are subjects_Table and Notes_Table, I want to display subject name as a link when someone click that link it display its relative subjects notes as download.
I am having a trouble one inserting links (hyperlink) or getting links from database... I don't know the right way to do it, can somebody please help...
(thanks)
Loading
Jignesh TrivediPosted Jun 21, 2013, 3:54 AM
you can do same thing with out using RowData Bound event.
i.e. with the help of Template which is already discribed in my second answer.
hope this will help you.
if this post is really helpful, please mark it accepted answer so that other can refer same post for same type of problem.
thanks
John JoePosted Jun 21, 2013, 2:59 AM
Jignesh TrivediPosted Jun 19, 2013, 4:21 AM
hi,
try following code.
in aspx grid code
HeaderStyle-ForeColor="White">
.cs row data bound event
void gvDetails_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink hyplnkID = new HyperLink();
hyplnkID.NavigateUrl = ("#" + e.Row.Cells[0].Text); // right your url
hyplnkID.Text = Convert.ToString(e.Row.Cells[0].Text);
e.Row.Cells[3].Controls.Add(hyplnkID);// = "write here html code to generate link";
}
}
hope this will help you.
John JoePosted Jun 19, 2013, 1:50 AM
Jignesh TrivediPosted Jun 18, 2013, 4:51 AM
hi,
using RowDataBound event of gridview or writing ItemTemplete,you can achieve same thing.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[3].Text = "write here html code to generate link";
}
}
or
and server side
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "callmethod")
{
//do some thing
}
}
Please refer
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx
hope this will help you.
John JoePosted Jun 18, 2013, 3:56 AM
I am using a web App... ASP.net (c#)
I have tried displaying in gridview but it appears as text not links.
I am not pretty sure howto make this work.
Jignesh TrivediPosted Jun 16, 2013, 11:57 PM
hi,
i have couple of question.
are you use window base application or web base?
to show data are you using grid view control?