Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hi Dear All,

Could anyone please tell me how to make a grid with Links? i.e, my requirement is when I click on a name in a gridview a graph should be displayed under the gridview. If anyone has idea please help me.

Thank You...
Posted

add LinkButton with RowCommand like below
ASP.NET
<asp:gridview autogeneratecolumns="false" runat="server" id="grdCustomPagging" onrowcommand="grdCustomPagging_RowCommand" >
   <columns>
     <asp:linkbutton runat="server" id="lnkView" commandargument='<%#Eval("DealId") %>'>
         CommandName="VIEW">View Deal</asp:linkbutton>
 </columns>
</asp:gridview>

in RowCommand event you can load the graph like below
C#
protected void grdCustomPagging_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "VIEW")
    {
        LinkButton lnkView = (LinkButton)e.CommandSource;
        string dealId = lnkView.CommandArgument;
        // do something with CommandArgument value like loading graph 
    }
}


check How to handle click event of linkbutton inside gridview[^]
 
Share this answer
 
v3
Hi Subhash, I would suggest you to learn basics of working with GridView control in ASP.NET. The following links might be helpful:

GridView all in one[^]

Insert, Update, Delete in ASP.NET Gridview, DataSource as SQL Server, MS Access (mdb/accdb), XML and Framework as 2.0 / 3.0 / 3.5 / 4.0 (VS 2005/2008/2010)[^]

- DD
 
Share this answer
 
There are different ways to do it. First, you can generate the graph in some bitmap on the fly, using System.Drawing. You can save result in a file or generate just the content of the fly in some ASP.NET page with appropriate header (such as "image/png").

See also:
http://en.wikipedia.org/wiki/Media_type[^],
http://www.iana.org/assignments/media-types/media-types.xhtml[^].

Another approach could be generating Javascript showing graphics based on HTML5 Canvas: http://en.wikipedia.org/wiki/HTML5_canvas[^].

You will be able to find several available frameworks for generation of Canvas graphics and different kinds of animation and interactive behavior. Please see my past answer: how to make a drawing area in asp.net[^].

—SA
 
Share this answer
 
Thanks a lot my dear friends...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900