0

I have aspx page with asp Literal. It's the control page, and literal will show message, when data has been saved to database, (after pressing SAVE button).

It work, but after i have saved and trying to refresh page, the literal text won't disappear... Is there any nice and easy way to hide literal text after refreshing the page?

I have tried jquery .hide method, but i have faced another problems with that.

In front page script i have this value:

        Literall.text="Saved!!!" 

And end of the page i have this:

        <h2 style="color:red;">
            <asp:Literal id="Literall" Text="" runat="server"/>
        </h2>
Teemu Laine
  • 361
  • 1
  • 3
  • 13

2 Answers2

0

Try using EnableViewState="False" on the Literal1 markup:

<asp:Literal EnableViewState="False" id="Literall" Text="" runat="server"/>
mshsayem
  • 17,557
  • 11
  • 61
  • 69
  • It won't disappear with that... :( – Teemu Laine May 07 '13 at 07:06
  • It's end of the sql command script. It's over 400 rows, so i won't post it all in [jsFiddle](http://jsfiddle.net/MjYzW/). Is that what you mean? – Teemu Laine May 07 '13 at 11:10
  • It is hard to say anything without seeing the whole code. But if `Literall.text="Saved!!!"` is executed in the button event handler it should not be a problem. If you put that in the `Page_Load`, that might be the problem. – mshsayem May 08 '13 at 00:56
  • [Here](http://jsfiddle.net/MjYzW/2/) is whole code, sorry, but it's in Finnish. In HTML Literal part is in line `132` and in script `273`. Script is in `` and html code is in `` – Teemu Laine May 08 '13 at 05:57
  • I see no problem in your code :(; But disabling viewstate really works; See [this little aspx page](http://jsfiddle.net/yB7HW/). If you click on the `Save` button it will show you the notification, if you click other button, the notification will be invisible just as desired. I suspect you are re-submitting the page multiple times. Note that pressing `F5` or `CTRL+R` re-submits the page in which case your `lomake` method runs multiple times. – mshsayem May 08 '13 at 06:11
0

put Literall.Text=""; in page load event

Robin Joseph
  • 1,210
  • 1
  • 11
  • 12
  • Do you mean this? `<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" Trace = "false" UICulture="fi" Literall.Text="" Culture="fi-fi" debug=true %>` – Teemu Laine May 07 '13 at 11:36
  • what actually i meant is you just add this in your page load event if(!IsPostback()) { Literall.Text=""; } – Robin Joseph May 12 '13 at 09:14