In Web application, asp.net web application I am using one link button/Image button of asp.net server control, when I click on that control it is loging out from the site. What could be the reason can you help me please.
The code is like this :
<img src="Images/aaa.png" width="24px" height="24px"/>
<asp:LinkButton ID="lnkhlpbtn" runat="server" PostBackUrl="../ss/ssn.aspx"
class="blue1_link"></asp:LinkButton>
(Posting my suggestion as an answer for sweet, sweet karma):
Also, why are you using <asp:LinkButton>? Why not a straightforward <a href="#">?
Related
I am using asp LinkButton in my masterpage and I would like to direct users to different pages based on whether they are anonymous(unauthenticated) or they are authenticated.
Here is my code:
<asp:LinkButton ID="HomeLink" runat="server" onclick="HomeLink_Click">
Home
</asp:LinkButton>
Problem with this is, I have never used this control before, and msdn doesn't provide a clear answer on how to do so.
Please help me with a sample code i could use in my code behind file.
I have a question for web service. I have been testing but not sure what is causing this. I am trying to prevent my web page from flickering when there is a post back. So I used web service. It is working fine without any noticeable flickering when I put my dropdownlist on a normal page (without Master page). However, when I moved the same code to page with master page, then the flickering happens. Anyone has any ideas how to fix this please? My html mark up is as below:
<div>
<div>
<asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True"></asp:DropDownList>
</div>
<div>
<asp:DropDownList ID="ddlCity" runat="server" DataTextField="city_name" DataValueField="city_id"></asp:DropDownList>
</div>
</div>
I am trying to avoid using update panel. Thanks
You will get the flikering as long as you have postback, you can use ajax call to refresh only part of page for instance drop down. One of easiest solution is to use UpdatePanel or you can use jQuery ajax. This article explains how you can make cascading dropdowns using jquery ajax with asp.net.
The deal is that when you have the following on your site it works:
Click Me!
But the above fails to work if that site is a nested application.
I have seen two solutions to this opportunity in asp.net.
The first solution that I found was to add the following:
<a runat="server" href="~/Some/Path/file.aspx" class="button">Click Me!</a>
I have not tried this because I feel it would add more crap to your view state.
The solution that I have tried is:
Click Me!
The question is, what is the preferred method of addressing paths in nested applications?
You want to use HyperLink server control. It is meant for that kind of thing.
<asp:HyperLink runat="server" ID="HyperLink1"
NavigateUrl="~/Some/Path/file.aspx"
CssClass="button">Click Me!</asp:HyperLink>
Render as
<a id="HyperLink1" class="button" href="/Some/Path/file.aspx">Click Me1</a>
ASP.Net HyperLink control uses ResolveClientUrl to resolve the given url, so you do not need to do anything.
im creating a umbraco plugin, which uses an asp:LinkButton. which looks something like this
<asp:LinkButton ID="ObjectInformationBtn" class="link" runat="server" Text="View Full Details of Item" OnClick="ObjectInformationBtn_Click"></asp:LinkButton>
when I test this plugin locally I get the following result
View Full Details of Item
however when I put the plugin on the website I get a complete different results, which looks like this
<p> </p>
can someone please tell me what is going on.
Are you sure the ascx containing the linkbutton is published to the production website in the usercontrols folder?
Do you have a Macro created that references the User Control that contains the LinkButton?
I didn't want to have a ton of code on one page, but to keep the code modular and simple. So in my TabContainer I have the following where each tab refers to a web page and my code is inside each web page. My TabContainer itself is inside the default.aspx page.
<asp:TabContainer ID="tabTOL" runat="server" ActiveTabIndex="0" CssClass="tol">
<asp:TabPanel ID="tabHome" runat="server" TabIndex="0" HeaderText="Home">
<ContentTemplate>
<iframe src="Home.aspx"></iframe>
</ContentTemplate>
</asp:TabPanel>
...
Of course, the problem is that I cannot refer to other tabs or the TabContainer/default page from within any tab. I'm trying to update a TextBox on the default.aspx page from a tab, but there is no reference to it.
Should I bite the bullet and have one huge web page with all the html and code behind? There are a dozen tabs in my TabContainer. I would think this would slow down processing as well. Or, is there a cleaner way to do this and still retain the ability to reference controls on the main page or other tabs?
I'm working in VS2008 and .Net 3.5 and AJAX 3.5.
Thanks!!
Larry
I would suggest that you change the structure of Home.Aspx into a Web User Control (*.ascx). The advantage is that you are now running within the context of the parent page. Therefore all it's functionality is within reach. For example, to acces a textbox on the parent page, from the Home.Ascx, you would do this:
((Default)this.Parent).txtMyTextBox.Text = "Hello";