This is the only form tag I have in the masterpages. (All other masterpages inherit from that page)
With the pages not posting back anymore I mean, that a control on a page that worked before stops to postback.
E.g.: A simple HelloWorld Example that postsback the value of a textbox like:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Literal1.Text = "Hello " + TextBox1.Text End Sub
after I have the LoginView on the page and you click Button1, the page reloads, but the content of the textbox is erased and the Literal.text is empty.
I actually had that exact problem on a site a couple of weeks ago. The linkbutton control somehow breaks the postback of a site. It forces the form to render the old doPostback javascript stuff, and that somehow breaks the postback.
My solution was to not use the linkbutton at all. As far as I can tell, you can just use regular links like Chris suggests.
I have a loginview and as I've noticed it takes two attempts to login to for the loginview to change the rendered template. (or one attempt and just open the same url in another tab inside the same browser instance)
I can not use simple <a> tag because it lacks the code-behind click event handling which I desperately need.
solved it...kinda...caused a programmatic response.redirect to request.rawurl on a button that initiates login inside the loginview control...should that be the way...honestly don't know?!?
Pages do not postback with loginview on it
Hi there,
if I put a loginview on my mastertemplate the pages do not postback anymore.
My LoginView is rather basic and works without problems in a non umbraco environment.
Whatever controls I have on my page, as soon as I put the LoginView on the masterpage. No more postbacks!
Also tried to create a User Control with the LoginView on it, but that has the same effect.
Why is that and what can I do?
I am using umbraco v 4.0.2.1 (Assembly version: 1.0.3441.17657)
thanks
Christian
Hi Christian,
Are you including <form runat="server"> tags in your master page?
What do you mean 'no more postbacks'? Do the buttons work but result in Page.Ispostback = false?
Check your markup structure and make sure you don't have any nested <form> tags. Does your markup validate?
Cheers,
Chris
Hi,
my mastertemplate looks like:
This is the only form tag I have in the masterpages. (All other masterpages inherit from that page)
With the pages not posting back anymore I mean, that a control on a page that worked before stops to postback.
E.g.: A simple HelloWorld Example that postsback the value of a textbox like:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Literal1.Text = "Hello " + TextBox1.Text
End Sub
after I have the LoginView on the page and you click Button1, the page reloads, but the content of the textbox is erased and the Literal.text is empty.
Christian
I have no idea why this isn't working. LinkButton requires Javascript to be enabled is this enabled? If not, could you use a standard <a> tag instead?
I actually had that exact problem on a site a couple of weeks ago. The linkbutton control somehow breaks the postback of a site. It forces the form to render the old doPostback javascript stuff, and that somehow breaks the postback.
My solution was to not use the linkbutton at all. As far as I can tell, you can just use regular links like Chris suggests.
I'm using a link button inside of a usercontrol just fine with post back.
Using <a> tags rather than a LinkButton also removes an unrequired dependency on JavaScript.
thanks for all the replies.
replacing the LinkButton with <a> "solved" the problem, but I am still wondering why and are there other ASP controls that should not be used?
I find it also strange, that this works without problems in a non umbraco setup.
Any other solution to this problem plz?!
I have a loginview and as I've noticed it takes two attempts to login to for the loginview to change the rendered template. (or one attempt and just open the same url in another tab inside the same browser instance)
I can not use simple <a> tag because it lacks the code-behind click event handling which I desperately need.
TIA all
solved it...kinda...caused a programmatic response.redirect to request.rawurl on a button that initiates login inside the loginview control...should that be the way...honestly don't know?!?
I have the similar problem with an ImageButton, it does not call the OnClick code behind after a postback.
First time ASP.NET generates on page the usual function
function __doPostBack(eventTarget, eventArgument) { ... }
But after posting back page does not generate this so button code behind is not called.
is working on a reply...