Reputation: 7864
I'm not sure how to even go about looking up the answer to this question, so I apologize for not having done any research before posting. I have never touched ASP.NET before. I migrated one IIS project to a different server, and it's working as intended, except for one thing. I believe the below code snippet is responsible for creating links in a table, but it's hardcoding the links to the old URL instead of the new one. I'm not sure how to edit the ASP.NET to correct the problem and point to the new server instead. Any thoughts? Is a different code snippet responsible?
The code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvPublicPositionList" runat="server" AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource_PublicPositionList" Width="800">
<Columns>
<asp:TemplateField HeaderText="Title" SortExpression="Title">
<ItemTemplate>
<asp:LinkButton ID="lbGotoJobDescription" runat="server" CausesValidation="False" CommandName="Select"
Text='<% #Eval("Title") %>' PostBackUrl='<% #Eval("URL") %>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Department" HeaderText="Department" SortExpression="Department" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource_PublicPositionList" runat="server" ConnectionString="<%$ ConnectionStrings:JobDescriptionsConnectionStringPublic2005 %>"
SelectCommand="spSelectPublicPositionList" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:JobDescriptionsConnectionStringPublic2005 %>"
SelectCommand="SELECT * FROM [tblDepartments]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
The link format:
javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("gvPublicPositionList$ctl02$lbGotoJobDescription", "", false, "", "CORRECT LINK BUT TO OLD SERVER", false, true))
Upvotes: 0
Views: 35
Reputation: 40413
The URL is coming from some data source in the code, so you'll have to find where that's getting populated. The <% #Eval("URL") %>
code means that you're bound to something called URL
- could be a database value, could be a property of some object, no way to know without seeing the data source.
So find out where this control is being populated (it will probably look something like someRepeater.DataSource = someDataSource;
, and that will tell you what you need to change.
Upvotes: 2