INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Page direct based on program contained in gridview

Page direct based on program contained in gridview

(OP)
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 = "http://myserver/myapplicatgion/ReviewPhysicianARNP...="
ElseIf MyProgram = "Nurses-Residential" Then
myurlpath = "http://myserver/myapplicatgion/ReviewNurseOP.aspx?...="
ElseIf MyProgram = "Nurses-Outpatient" Then
myurlpath = "http://myserver/myapplicatgion/ReviewNurseIP.aspx?...="
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 = "http://myserver/myapplicatgion/ReviewClinician.asp...="
ElseIf MyProgram = "BHT Crossroads-Residential" Or MyProgram = "BHT Crossroads-Detox" Then
myurlpath = "http://myserver/myapplicatgion/ReviewBHTCrossRoads...="
ElseIf MyProgram = "Case Managers-Forensics" Then
myurlpath = "http://myserver/myapplicatgion/ReviewCaseMgrForens...="
ElseIf MyProgram = "Case Managers-Adult TCM" Or MyProgram = "Case Managers-Child TCM" Then
myurlpath = "http://myserver/myapplicatgion/ReviewCaseMgrTCM.as...="
End If
End Sub

My Errors:
Path displayed as URL:
http://myserver/myapplication/myurlpath&Review...

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.

RE: Page direct based on program contained in gridview

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!

RE: Page direct based on program contained in gridview

(OP)
thanks for the help. Just got fired because I couldn't get this to work... DeletE thread.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close