Simple LinkButton

R

RN1

An ASPX page, named LinkButton.aspx, has a single LinkButton & nothing
else. The code is very simple:

<form runat="server">
<asp:LinkButton ID="lnk" PostBackUrl="Page1.aspx" Text="CLICK"
runat="server"/>
</form>

When I run the above code in my local; (Intranet) IIS server, then
when the LinkButton is clicked, the user is taken to Page1.aspx but
when I uploaded the above ASPX file to a remote server & ran the page,
clicking the LinkButton doesn't take the user to Page1.aspx. Rather,
the user is brought back to LinkButton.aspx.

Why so? If I am not mistaken, PostBackUrl means posting a page to
itself (unlike the NavigateUrl property of the HyperLink control which
takes the user to a different page); so why is the LinkButton behaving
differently when the ASPX page is run in my local server & when the
same ASPX page is run in a remote server?

Also when I right-click the link & then click "Properties" in my local
server, the URL is

javascript:WebForm_DoPostBackWithOptions(new
%20WebForm_PostBackOptions("lnk",%20"",%20false,%20"",%20"Page1.aspx",
%20false,%20true))

but the URL of the link in the remote server turns out to be

javascript:__doPostBack('lnk','')

Why?

Thanks,

Ron
 
R

RN1

An ASPX page, namedLinkButton.aspx, has a singleLinkButton& nothing
else. The code is verysimple:

<form runat="server">
<asp:LinkButtonID="lnk" PostBackUrl="Page1.aspx" Text="CLICK"
runat="server"/>
</form>

When I run the above code in my local; (Intranet) IIS server, then
when theLinkButtonis clicked, the user is taken to Page1.aspx but
when I uploaded the above ASPX file to a remote server & ran the page,
clicking theLinkButtondoesn't take the user to Page1.aspx. Rather,
the user is brought back toLinkButton.aspx.

Why so? If I am not mistaken, PostBackUrl means posting a page to
itself (unlike the NavigateUrl property of the HyperLink control which
takes the user to a different page); so why is theLinkButtonbehaving
differently when the ASPX page is run in my local server & when the
same ASPX page is run in a remote server?

Also when I right-click the link & then click "Properties" in my local
server, the URL is

javascript:WebForm_DoPostBackWithOptions(new
%20WebForm_PostBackOptions("lnk",%20"",%20false,%20"",%20"Page1.aspx",
%20false,%20true))

but the URL of the link in the remote server turns out to be

javascript:__doPostBack('lnk','')

Why?

Thanks,

Ron

Can someone please clear my doubts?

Thanks,

Ron
 
D

darrel

Can someone please clear my doubts?

I dislike anything in .net that uses javascript postback links. They're not
accessible and tend to hide the logic.

Now, maybe that's unfair, but when I need to make public-facing websites, I
tend to avoid them.

So, anyhow, it appears that the source code on your local machine just isn't
the same as what's on your server. Are you SURE the files are the same?

-Darrel
 
R

RN1

I dislike anything in .net that uses javascript postback links. They're not
accessible and tend to hide the logic.

Now, maybe that's unfair, but when I need to make public-facing websites, I
tend to avoid them.

So, anyhow, it appears that the source code on your local machine just isn't
the same as what's on your server. Are you SURE the files are the same?

-Darrel

Yes Darrel I am more than 100% sure that the files on my Intranet &
remote server are the same. It was I only who created & uploaded the
ASPX file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top