|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GridView Hyperlink fieldI 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,VOXDIR" 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?SpeechFileID{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 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?SpeechFileID{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: msd***@microsoft.com. ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/subscriptions/aa948874.aspx ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. -------------------- Show quoteHide quote >From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <Morris@online.nospam> >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,VOXDIR" >DataSourceID="AccessDataSource1" > Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080" > 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. -- Show quoteHide quoteThanks 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?SpeechFileID{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: > msd***@microsoft.com. > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#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/subscriptions/aa948874.aspx > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. > > > > > -------------------- > >From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <Morris@online.nospam> > >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,VOXDIR" > >DataSourceID="AccessDataSource1" > > Font-Names="Verdana" Font-Size="8pt" BorderColor="#FFC080" > > > > 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: msd***@microsoft.com. -------------------- >From: =?Utf-8?B?TW9ycmlzIE5ldW1hbg==?= <Morris@online.nospam> <zJTK5WheJHA.***@TK2MSFTNGHUB02.phx.gbl>>References: <08008B68-7307-4A8D-B7F4-BF621C62C***@microsoft.com> Show quoteHide quote >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
Dropdownlist datasource dependency
Check for table Adapting ReorderList WebControl for rendering dynamic html OnClientClick="javascript:enableValidators(....) error OnClientClick with confirm doesn't work Need help for solution in ASP.NET with VB Panels and dynamic controls...again Validator for checkbox is not getting triggered always Master/Content Page Error in Design/Split View |
|||||||||||||||||||||||