473,770 Members | 4,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 1911
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
1224
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 1996 12,000 link2
0
1768
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
2941
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
1691
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
11900
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 page, then the first row hyper link color changes to look as "visited". Then the user navigates to...
3
1546
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 another value in the datagridview it should automatically give hyper link to different page with respect...
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
2928
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 directly without this winow appearing.
1
3058
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 only, and simply plain-output those which say "None" or "Not available".
0
9592
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10230
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10004
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8886
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.