Webmaster Forums Banner Professional Hosting from Just Host
Welcome Guest Search | Active Topics | Members | Log In | Register

Gridview control in asp.net Options
hari
Posted: Wednesday, May 28, 2008 5:25:53 AM
Rank: Advanced Member
Groups: Member

Joined: 3/31/2008
Posts: 59
Points: 177
Location: NY
hi,

I have created a gridview one column must come from a database and i want to display the content of another filed as hyperlink. when i add hyperlink field in the gridview i was not able to view in the screen. Can anybody let me know how to add a hyperlinkfield in a grid view
Sponsor
Posted: Wednesday, May 28, 2008 5:25:53 AM
sachin
Posted: Wednesday, May 28, 2008 5:27:22 AM
Rank: Advanced Member
Groups: Member

Joined: 3/3/2008
Posts: 78
Points: 234
Location: India
Design Mode:

Code:
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" Width="100%" >

<Columns>

<asp:BoundField DataField="Heading" HeaderText="HeadLine" />
<asp:BoundField DataField="Date" DataFormatString="{0:dd/MMM/yyyy}" HeaderText="Date Posted" HtmlEncode="False" />

<asp:BoundField DataField="Status" HeaderText="Status" />

<asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="./URL" Text="Edit" />

</Columns>

</asp:GridView>


CODE windows
Code:
DataSet ds = new DataSet();protected void Page_Load(object sender, EventArgs e)

{
SqlConnection sqlConn = new SqlConnection("Server=SYSTEM9\\SQLEXPRESS;Initial Catalog=Master_Web;User ID=sa;Password=.;");

sqlConn.Open();

SqlCommand sComm = new SqlCommand("Select * from Tablename", sqlConn);
SqlDataAdapter sqlda = new SqlDataAdapter(sComm);

sqlda.Fill(ds);

GridView1.DataSource = ds.Tables[0].DefaultView;

GridView1.DataBind();

}




Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

ASPNET Theme created by Boskone (Dan Ferguson)
Powered by HaqTech.Com
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 2.191 seconds.