Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 391
  • Last Modified:

ASP.net Gridview Select Button on hyperlink not activated.

Can someone see why this is not working?  It worked and now its now.  I can not figure out what I changed that caused the Select problem. When I run my page, the Select is there but its not underlined.
<asp:GridView runat="server" id="GridView1" DataKeyNames="AccountNumber" AutoGenerateColumns="False" DataSourceID="Meditech" AllowSorting="True" CellPadding="1" BackColor="#E5E5E5" BorderColor="Black" BorderWidth="2px" GridLines="None" ForeColor="Black" CellSpacing="3" Width="850px" Height="142px">
	<FooterStyle BackColor="Black" />
	<RowStyle VerticalAlign="Middle" HorizontalAlign="Left" />
	<PagerStyle HorizontalAlign="Center" BackColor="#F4E1E1" ForeColor="#F4E1E1" />
	<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="White" HorizontalAlign="Left" />
	<HeaderStyle BackColor="Silver" Font-Bold="True" />
	<EditRowStyle HorizontalAlign="Left" />
	<AlternatingRowStyle BackColor="White" />
	<emptydatarowstyle BackColor="Silver" forecolor="Black"/>
            <Columns>
<asp:hyperlinkfield DataNavigateUrlFields="AccountNumber,Name,BirthDateTime,ServiceDateTime,Status,LocationName" DataNavigateUrlFormatString="patient_report.aspx?AccountNumber={0} &amp;Name={1} &amp;BirthDateTime={2} &amp;ServiceDateTime={3} &amp;Status={4} &amp;LocationName={5}" Text="Select">
	</asp:hyperlinkfield>
				<asp:boundfield DataField="AccountNumber" HeaderText="Account" ReadOnly="True" SortExpression="AccountNumber">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
				<asp:boundfield DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
				<asp:boundfield DataField="BirthDateTime" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Birthdate" HtmlEncode="False" ReadOnly="True" SortExpression="BirthDateTime">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
				<asp:boundfield DataField="ServiceDateTime" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Admit/Service" HtmlEncode="False" ReadOnly="True" SortExpression="ServiceDateTime">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
				<asp:boundfield DataField="Status" HeaderText="Status" ReadOnly="True" SortExpression="Status">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
				<asp:boundfield DataField="LocationName" HeaderText="Location" ReadOnly="True" SortExpression="LocationName">
					<HeaderStyle HorizontalAlign="Left" />
				</asp:boundfield>
		</Columns>
 
	</asp:GridView>

Open in new window

0
aninec
Asked:
aninec
  • 2
  • 2
1 Solution
 
aibusinesssolutionsCommented:
<asp:hyperlinkfield DataNavigateUrlFields="AccountNumber,Name,BirthDateTime,ServiceDateTime,Status,LocationName" DataNavigateUrlFormatString="patient_report.aspx?AccountNumber={0} &amp;Name={1} &amp;BirthDateTime={2} &amp;ServiceDateTime={3} &amp;Status={4} &amp;LocationName={5}" Text="Select">
</asp:hyperlinkfield>

It may be the extra spacing you have in the FormatString.  Try just using &

patient_report.aspx?AccountNumber={0}&Name={1}&BirthDateTime={2}&ServiceDateTime={3}&Status={4}&LocationName={5}"
0
 
aninecAuthor Commented:
No change.  I tried taking off those DATETIME fields and then its fine.  As soon as I add them back in...no go.  I added two boundfields for these because I am changing their properties for the grid by taking off the time.  But still nothing.  

patient_report.aspx?AccountNumber={0}&Name={1}&BirthDateTime2={2}&ServiceDateTime2={3}&Status={4}&LocationName={5}"


<asp:boundfield DataField="BirthDateTime" HeaderText="Birthdate2" HtmlEncode="False" ReadOnly="True" SortExpression="BirthDateTime2">
<HeaderStyle HorizontalAlign="Left" />
            </asp:boundfield>
<asp:boundfield DataField="ServiceDateTime" HeaderText="Admit/Service2" HtmlEncode="False" ReadOnly="True" SortExpression="ServiceDateTime2">
      <HeaderStyle HorizontalAlign="Left" />
0
 
aibusinesssolutionsCommented:
That may be your problem then, instead of adding additional columns to remove the time, just use {0:d}

Notice the DataFormatString below.  

<asp:boundfield DataField="ServiceDateTime" DataFormatString="{0:d}" HeaderText="Admit/Service2" HtmlEncode="False" ReadOnly="True" SortExpression="ServiceDateTime" >

0
 
prairiedogCommented:
>>>BirthDateTime2={2}&ServiceDateTime2={3}
===> BirthDateTime2={2:d}&ServiceDateTime2={3:d}&
0
 
aninecAuthor Commented:
That is one beautiful chunk of coding Prairie Dog!!!  Its great and it solved another issue on the other page.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now