Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page direct based on program contained in gridview

Status
Not open for further replies.

RAWC

Technical User
Dec 14, 2001
32
US
I am attempting my first asp.net/vb.net application.
I have 15 clinical programs that a user may be a member of.
When a row is selected in the gridview, I would like to get the value of the clinical program the employee is a member of.
I would then like to set what page url is used for the redirect.
I can not get the "myurlpath" field to be used as a url path.
The URL that is displayed is
The "important" lines of code are as follows:
The Grid:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
CellPadding="3" CellSpacing="1" DataSourceID="SqlDataSource1"
EnableModelValidation="True" GridLines="None"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:TemplateField FooterText="0">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="myurlpath{16}&Review_ID{1}&Employee={2}&Program={5}&DateAssigned={6}&PRClientID={9}"
Text="Start Review"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ReviewID" HeaderText="ReviewID"
SortExpression="ReviewID" FooterText="1" />
<asp:BoundField DataField="Reviewer" HeaderText="Reviewer"
SortExpression="Reviewer" FooterText="2" />
<asp:BoundField DataField="Employee" HeaderText="Employee"
SortExpression="Employee" FooterText="3" />
<asp:BoundField DataField="DateComplete" HeaderText="DateComplete"
SortExpression="DateComplete" FooterText="4" />
<asp:BoundField DataField="AssignedBy" HeaderText="AssignedBy"
SortExpression="AssignedBy" FooterText="5" />
<asp:BoundField DataField="Program" HeaderText="Program"
SortExpression="Program" FooterText="6" />
<asp:BoundField DataField="DateAssigned" HeaderText="DateAssigned"
SortExpression="DateAssigned" FooterText="7" />
<asp:BoundField DataField="ReviewerEmail" HeaderText="ReviewerEmail"
SortExpression="ReviewerEmail" FooterText="8" />
<asp:BoundField DataField="SupervisorEmail" HeaderText="SupervisorEmail"
SortExpression="SupervisorEmail" FooterText="9" />
<asp:BoundField DataField="PRClientID" HeaderText="PRClientID"
SortExpression="PRClientID" FooterText="10" />
<asp:BoundField DataField="DateOfService" HeaderText="DateOfService"
SortExpression="DateOfService" FooterText="11" />
<asp:BoundField DataField="EditedBy1" HeaderText="EditedBy1"
SortExpression="EditedBy1" FooterText="12" />
<asp:BoundField DataField="EditedBy2" HeaderText="EditedBy2"
SortExpression="EditedBy2" FooterText="13" />
<asp:BoundField DataField="EditedBy3" HeaderText="EditedBy3"
SortExpression="EditedBy3" FooterText="14" />
<asp:BoundField DataField="EditedBy4" HeaderText="EditedBy4"
SortExpression="EditedBy4" FooterText="15" />
<asp:BoundField DataField="myurlpath" HeaderText="myurlpath"
SortExpression="myurlpath" FooterText="16" />
</Columns>
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DLCPeerRvwConnectionString %>"
SelectCommand="SELECT * FROM [AssignedReviews]"></asp:SqlDataSource>
</td>
The Code Behind: (myserver and myapplication have replace the true names of the server and application for demonstration purposes)

Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim MyProgram As String
MyProgram = "GridView1.SelectedRow.Cells[6].Text"

If MyProgram = "Physicians-Residential" Or MyProgram = "Physicians-Outpatient" Or MyProgram = "ARNP-Outpatient" Then
myurlpath = " ElseIf MyProgram = "Nurses-Residential" Then
myurlpath = " ElseIf MyProgram = "Nurses-Outpatient" Then
myurlpath = " ElseIf MyProgram = "Clinicians-ESAC" Or MyProgram = "Clinicians-Admission Services" Or MyProgram = "Clinicians-Outpatient" Or MyProgram = "Clinicians-Child Community Svcs(Wrap/BNet/TBOS)" Or MyProgram = "Clinicians-Drug Court/FIRST" Then
myurlpath = " ElseIf MyProgram = "BHT Crossroads-Residential" Or MyProgram = "BHT Crossroads-Detox" Then
myurlpath = " ElseIf MyProgram = "Case Managers-Forensics" Then
myurlpath = " ElseIf MyProgram = "Case Managers-Adult TCM" Or MyProgram = "Case Managers-Child TCM" Then
myurlpath = " End If
End Sub

My Errors:
Path displayed as URL:

Server Error
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
 
The problem is this line:

NavigateUrl="myurlpath{16}&Review_ID{1}&Employee={2}&Program={5}&DateAssigned={6}&PRClientID={9}"

You have the variable myurlpath inside the double quotes, which makes that part of the literal string, not concatenates it as you want. Change the line to move myurlpath out of the quotes:

NavigateUrl = myurlpath & "{16}&Review_ID={1}&Employee={2}&Program={5}&DateAssigned={6}&PRClientID={9}"

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
thanks for the help. Just got fired because I couldn't get this to work... DeletE thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top