Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > GridView Hyperlink field

Reply
Thread Tools

GridView Hyperlink field

 
 
Morris Neuman
Guest
Posts: n/a
 
      01-18-2009
Hi,

I have a GrideView which is bound to a datasourcecontrol. One of the
columns is a HyperLink to another web page passing it parameters. This
Hyperlink does not show as a hyperlink when viewing the grid. I have this
working on other pages but cannot get this to work. Don't know what I have
coded incorrectly. Please help.

Below is the definition of the GridView with the HyperLink field.


<asp:GridView ID="GridView2" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="Account,MessageID,SpeechFileID,VOXDI R"
DataSourceID="AccessDataSource1"
Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080"
BorderStyle="Solid" BorderWidth="1px" Width="579px" CellPadding="5"
CellSpacing="1" ForeColor="Navy" >
<Columns>
<asp:CommandField ShowEditButton="True" EditText="Edit Status" >
<ControlStyle Font-Bold="False" ForeColor="DarkSlateGray" />
<HeaderStyle BackColor="Lavender" />
<ItemStyle BackColor="Lavender" BorderColor="SlateGray"
BorderStyle="Inset" BorderWidth="2px" />
</asp:CommandField>

<asp:HyperLinkField DataNavigateUrlFields="SpeechFileID,VOXDIR"
DataNavigateUrlFormatString="EmailMsg2.aspx?Speech FileID{0}&VOXDIR{1}"
Text="Email Message2 via HLink" >
</asp:HyperLinkField>

</Columns>
<RowStyle BackColor="BlanchedAlmond" />
<EmptyDataTemplate>
No messages for selected mailbox
</EmptyDataTemplate>
<HeaderStyle BorderColor="#FFC080" Font-Bold="False"
BackColor="#FFC080" />
<AlternatingRowStyle BackColor="SeaShell" />
<PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
</asp:GridView>

--
Thanks
Morris
 
Reply With Quote
 
 
 
 
Steven Cheng
Guest
Posts: n/a
 
      01-19-2009
Hi Morris,

As for the GridView Hyperlink column, I've performed some local test via
the page source you provided. I use a self generated DataTable as
datasource and remain the other Gridview column setting unchanged. It seems
the hyperlink can display correctly:

Here is the completely test page(aspx and codebehind), you can directly run
them in a test page on your side and compare with the problem page:

==============================
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView2" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False"
DataKeyNames="SpeechFileID,VOXDIR"

Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080"
BorderStyle="Solid" BorderWidth="1px" Width="579px" CellPadding="5"
CellSpacing="1" ForeColor="Navy" >
<Columns>
<asp:CommandField ShowEditButton="True" EditText="Edit Status" >
<ControlStyle Font-Bold="False" ForeColor="DarkSlateGray" />
<HeaderStyle BackColor="Lavender" />
<ItemStyle BackColor="Lavender" BorderColor="SlateGray"
BorderStyle="Inset" BorderWidth="2px" />
</asp:CommandField>

<asp:HyperLinkField DataNavigateUrlFields="SpeechFileID,VOXDIR"
DataNavigateUrlFormatString="EmailMsg2.aspx?Speech FileID{0}&VOXDIR{1}"
Text="Email Message2 via HLink" >
</asp:HyperLinkField>

</Columns>
<RowStyle BackColor="BlanchedAlmond" />
<EmptyDataTemplate>
No messages for selected mailbox
</EmptyDataTemplate>
<HeaderStyle BorderColor="#FFC080" Font-Bold="False"
BackColor="#FFC080" />
<AlternatingRowStyle BackColor="SeaShell" />
<PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
</asp:GridView>

</div>
</form>
</body>
=============================

===============code behind============
public partial class DataTestPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind_Test_Data();
}
}

void Bind_Test_Data()
{
DataTable dt = new DataTable("TestTable");

dt.Columns.Add("SpeechFileID");
dt.Columns.Add("VOXDIR");

for (int i = 0; i < 10; ++i)
{
dt.Rows.Add("SpeechFile_" + i, "VOXDIR_" + i);
}

GridView2.DataSource = dt;
GridView2.DataBind();
}
}
=============================

If there is anything unclear or any further finding, please feel free to
post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
>From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <(E-Mail Removed)>
>Subject: GridView Hyperlink field
>Date: Sun, 18 Jan 2009 15:03:16 -0800


>
>Hi,
>
>I have a GrideView which is bound to a datasourcecontrol. One of the
>columns is a HyperLink to another web page passing it parameters. This
>Hyperlink does not show as a hyperlink when viewing the grid. I have this
>working on other pages but cannot get this to work. Don't know what I

have
>coded incorrectly. Please help.
>
>Below is the definition of the GridView with the HyperLink field.
>
>
> <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
>AllowSorting="True"
> AutoGenerateColumns="False"
> DataKeyNames="Account,MessageID,SpeechFileID,VOXDI R"
>DataSourceID="AccessDataSource1"
> Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080"
>


 
Reply With Quote
 
 
 
 
Morris Neuman
Guest
Posts: n/a
 
      01-19-2009
Cannot get my code to work. I have a similar grid on another page with
hyperlink data navigation URL and that work.

Anyway, I created a column with a template field and then placed the
hyperlink in the template and that seems to work.

Thanks for your help.
--
Thanks
Morris


""Steven Cheng"" wrote:

> Hi Morris,
>
> As for the GridView Hyperlink column, I've performed some local test via
> the page source you provided. I use a self generated DataTable as
> datasource and remain the other Gridview column setting unchanged. It seems
> the hyperlink can display correctly:
>
> Here is the completely test page(aspx and codebehind), you can directly run
> them in a test page on your side and compare with the problem page:
>
> ==============================
> <body>
> <form id="form1" runat="server">
> <div>
> <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
> AllowSorting="True"
> AutoGenerateColumns="False"
> DataKeyNames="SpeechFileID,VOXDIR"
>
> Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080"
> BorderStyle="Solid" BorderWidth="1px" Width="579px" CellPadding="5"
> CellSpacing="1" ForeColor="Navy" >
> <Columns>
> <asp:CommandField ShowEditButton="True" EditText="Edit Status" >
> <ControlStyle Font-Bold="False" ForeColor="DarkSlateGray" />
> <HeaderStyle BackColor="Lavender" />
> <ItemStyle BackColor="Lavender" BorderColor="SlateGray"
> BorderStyle="Inset" BorderWidth="2px" />
> </asp:CommandField>
>
> <asp:HyperLinkField DataNavigateUrlFields="SpeechFileID,VOXDIR"
> DataNavigateUrlFormatString="EmailMsg2.aspx?Speech FileID{0}&VOXDIR{1}"
> Text="Email Message2 via HLink" >
> </asp:HyperLinkField>
>
> </Columns>
> <RowStyle BackColor="BlanchedAlmond" />
> <EmptyDataTemplate>
> No messages for selected mailbox
> </EmptyDataTemplate>
> <HeaderStyle BorderColor="#FFC080" Font-Bold="False"
> BackColor="#FFC080" />
> <AlternatingRowStyle BackColor="SeaShell" />
> <PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
> </asp:GridView>
>
> </div>
> </form>
> </body>
> =============================
>
> ===============code behind============
> public partial class DataTestPage : System.Web.UI.Page
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> if (!IsPostBack)
> {
> Bind_Test_Data();
> }
> }
>
> void Bind_Test_Data()
> {
> DataTable dt = new DataTable("TestTable");
>
> dt.Columns.Add("SpeechFileID");
> dt.Columns.Add("VOXDIR");
>
> for (int i = 0; i < 10; ++i)
> {
> dt.Rows.Add("SpeechFile_" + i, "VOXDIR_" + i);
> }
>
> GridView2.DataSource = dt;
> GridView2.DataBind();
> }
> }
> =============================
>
> If there is anything unclear or any further finding, please feel free to
> post here.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> (E-Mail Removed).
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#notifications.
>
> Note: MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 2 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions. Issues of this
> nature are best handled working with a dedicated Microsoft Support Engineer
> by contacting Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>
> --------------------
> >From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <(E-Mail Removed)>
> >Subject: GridView Hyperlink field
> >Date: Sun, 18 Jan 2009 15:03:16 -0800

>
> >
> >Hi,
> >
> >I have a GrideView which is bound to a datasourcecontrol. One of the
> >columns is a HyperLink to another web page passing it parameters. This
> >Hyperlink does not show as a hyperlink when viewing the grid. I have this
> >working on other pages but cannot get this to work. Don't know what I

> have
> >coded incorrectly. Please help.
> >
> >Below is the definition of the GridView with the HyperLink field.
> >
> >
> > <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
> >AllowSorting="True"
> > AutoGenerateColumns="False"
> > DataKeyNames="Account,MessageID,SpeechFileID,VOXDI R"
> >DataSourceID="AccessDataSource1"
> > Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080"
> >

>
>

 
Reply With Quote
 
Steven Cheng
Guest
Posts: n/a
 
      01-20-2009
Hi Morris,

Thanks for your reply. If you need any help later, please feel free to post
here.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).

--------------------
>From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>Subject: RE: GridView Hyperlink field
>Date: Mon, 19 Jan 2009 12:11:02 -0800


>
>Cannot get my code to work. I have a similar grid on another page with
>hyperlink data navigation URL and that work.
>
>Anyway, I created a column with a template field and then placed the
>hyperlink in the template and that seems to work.
>
>Thanks for your help.
>--
>Thanks
>Morris
>
>
>""Steven Cheng"" wrote:
>
>> Hi Morris,
>>
>> As for the GridView Hyperlink column, I've performed some local test via
>> the page source you provided. I use a self generated DataTable as
>> datasource and remain the other Gridview column setting unchanged. It

seems
>> the hyperlink can display correctly:
>>
>> Here is the completely test page(aspx and codebehind), you can directly

run
>> t


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview row index of HyperLink field - how to? Bogdan ASP .Net 2 07-20-2009 01:05 PM
Retrieve information from Hyperlink and Button field on a GridView =?Utf-8?B?UnV5IENhc3RlbGxp?= ASP .Net 0 10-18-2006 05:44 PM
GridView Hyperlink Field Append URL? barkster ASP .Net 1 10-12-2006 01:02 AM
databound and hyperlink field needed in gridview Carlos ASP .Net 1 06-08-2006 04:17 AM
May I disable underline in one gridview Hyperlink field ? Dmitry N.Ananyev ASP .Net Datagrid Control 1 07-01-2005 10:50 AM



Advertisments