473,545 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview with hyper link

hello friend
am new in asp.net
i have one doubt pls help me

page load:

DataSet ds = BuildDataSet();
DataGrid1.DataS ource = ds;
DataGrid1.DataB ind();
private DataSet BuildDataSet()
{
DataSet ret = new DataSet();
DataTable dt = new DataTable();
DataRow dr = null;

// Define table column names and datatypes
DataColumn dc = new DataColumn("ID" ,Type.GetType(" System.Int32")) ;
dt.Columns.Add( dc);
dc = new DataColumn("Nam e",Type.GetType ("System.String "));
dt.Columns.Add( dc);
dc = new DataColumn("Dat e",Type.GetType ("System.DateTi me"));
dt.Columns.Add( dc);

// Fill the table with sample data
for(int i = 1;i < = 10;i++)
{
dr = dt.NewRow();
dr["ID"] = i;
dr["Name"] = "John Smith";
dr["Date"] = DateTime.Now.Ad dSeconds(i * 10);
dt.Rows.Add(dr) ;
}

// Return the dataset to the caller
ret.Tables.Add( dt);

return ret;
}
current output

ID Name date
1 johnsmith
..
....

i need one more link colum

how can i add

i want out put looks like this

ID Name Date link
1 john smith 1/1/2007 hyperlink (link go to my another page b.aspx)

pls help me it is very urgent

May 5 '07 #1
1 1894
On May 5, 11:16 am, yogarajan.gane. ..@gmail.com wrote:
hello friend
am new in asp.net
i have one doubt pls help me

page load:

DataSet ds = BuildDataSet();
DataGrid1.DataS ource = ds;
DataGrid1.DataB ind();

private DataSet BuildDataSet()
{
DataSet ret = new DataSet();
DataTable dt = new DataTable();
DataRow dr = null;

// Define table column names and datatypes
DataColumn dc = new DataColumn("ID" ,Type.GetType(" System.Int32")) ;
dt.Columns.Add( dc);
dc = new DataColumn("Nam e",Type.GetType ("System.String "));
dt.Columns.Add( dc);
dc = new DataColumn("Dat e",Type.GetType ("System.DateTi me"));
dt.Columns.Add( dc);

// Fill the table with sample data
for(int i = 1;i < = 10;i++)
{
dr = dt.NewRow();
dr["ID"] = i;
dr["Name"] = "John Smith";
dr["Date"] = DateTime.Now.Ad dSeconds(i * 10);
dt.Rows.Add(dr) ;

}

// Return the dataset to the caller
ret.Tables.Add( dt);

return ret;}

current output

ID Name date
1 johnsmith
.
...

i need one more link colum

how can i add

i want out put looks like this

ID Name Date link
1 john smith 1/1/2007 hyperlink (link go to my another page b.aspx)

pls help me it is very urgent
<asp:GridView ... AutoGenerateCol umns="false" runat="server">
<Columns>
<asp:BoundFie ld DataField="ID" />
<asp:BoundFie ld DataField="Name " />
<asp:BoundFie ld DataField="Date " DataFormatStrin g="{0:MM/dd/yyyy}"
HtmlEncode="fal se" />
<asp:TemplateFi eld>
<ItemTemplate >
<a href="b.aspx">l ink</a>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>

May 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1203
by: CSharpguy | last post by:
In my gridview i need to add hyper links but add them as such headers - - -- --------------------------------------------- ------------------------------------------------------------- link1 BMW 2005 25,000 link2 ---------------------------------------------------------------- link1 Lexus ...
0
1756
by: jobo | last post by:
Hey there, I'm having a problem getting sorting to work. Here's what the GridView looks like: "server" ID="updt1" Mode="Conditional">
3
2926
by: ajaspersonal | last post by:
"i want to change font_style (hyper link<a href...>text</a>) normal to italics.when load a page" this is my problem but that label included in one 'USERCONTROL' This user controls may condain 4 link (<a href...>page1.aspx</a <br <a href ....>page2</aetc..). that will redirect another page ex:(page1.aspx).
1
1682
by: simons | last post by:
Hi All, I'm trying to add a hyper link to one of the filed in my DataList control. I added a link button but could not bound it to an ID filed and then link it to the page that i need. I'm trying to build a news posting system running an access DB, which will link the front page with all the news headers to a news page.
4
11894
by: Jeff | last post by:
Hi, I have a ASP.NET 2.0 Web Application. Many of the pages use the ASP.NET GridView with paging and sorting. One of the columns of this Gridview is a template column (LinkButton). The data being retrieved and showed in this GridView produce more than one page of data. A given user clicks on the first row hyper link on the Grid on the first...
3
1537
by: peerraghu | last post by:
hi,right now i creating travel project using asp.net 2005 and c# i can populate all the columns in the datagridview and even i am able to give hyprelink to paticular column but my problem is every time when i click it is redirecting to the same page, i want to display different page after clicking different hyperlink and if we want to insert...
9
382
by: rosoft | last post by:
Hi I'm using a GridView to list data from a table in my database. On of the fields is a URL and when I click a row in the GridView I want the page to automaticly open that link. How do I write code to an event i the GridView so that when I click a row the page opens up the new link in another window? Lars
1
2917
by: Kalaram | last post by:
I am makeing a CD, and in this CD i have alot of .pdf & .ppt & .pps files and i have one html page that i use as index to all the files, when i click on the hyper link of .pdf file , it opens normally. but whn i click on the hyper link of .ppt or .pps file, it shows a small windows that asks me to "open or save". can i make it open...
1
3034
by: Author | last post by:
I got into trouble with this problem. The data I am presenting in a GridView control has a column called "Website". That data comes from a stored procedure in SQL Server 2000. Most of them have valid http urls. But some of them say "None" or "Not available". In the GridView, I would like create a hyperlink for those valid http urls...
0
7470
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7659
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7811
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7428
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7760
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5975
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5334
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3455
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.