Postback Problem

A

Alper OZGUR

Hi;
In my code i'm checking some conditions and if the condition fails i want to
postback the page. Tried using the below methods but the when form is loaded
the postback status is false.. how can i solve?

Page_Load(1,SystemEventArgs.Empty)
or
Response.write("<script> __doPostback('Mybase','Load');</script>")
 
E

Eliyahu Goldin

"Postback" means posting the page back to the server from the client. How is
your scenario related to this definition?

Eliyahu
 
A

Alper OZGUR

I'm counting some records.. if this value bigger than i gave. assigning some
value to a session object.. and need to postback the page..
cause there are lot's of codes writed in if postback=false then...
 
E

Eliyahu Goldin

What exactly do you mean under "need to postback"? To run the code located
in the "if postback=true" branch?

Eliyahu
 
A

Alper OZGUR

yes
haber iletisinde þunlarý said:
What exactly do you mean under "need to postback"? To run the code located
in the "if postback=true" branch?

Eliyahu
 
M

Mark Rae


private void Page_Load(object sender, System.EventArgs e)
{
if(Page.IsPostBack)
{
PostBackCode();
}
else
{
if(SomeOtherSetOfConditions)
{
PostBackCode();
}
}
}

private void PostBackCode()
{
// postback code
}
 
A

Alper OZGUR

Thank you for response. But this is not my solution.. I have to raise the
postback to true...
 
A

Alper OZGUR

at the code below i must raise the postback event..



If Session("TotalRecords") > 1500 Then

Say(rsxr.GetString("FALSESEARCH"))

Session("BigReport") = "True"

Session.Remove("SrchCrt")

FirstPage = True

Dim script As String = "@SCRIPT>__doPostBack('Btn_Pb','Click')@/SCRIPT>"

Page.RegisterClientScriptBlock("PostingBack", script.Replace("@", "<"))

End If
 
M

Mark Rae

at the code below i must raise the postback event..
Why?

Dim script As String = "@SCRIPT>__doPostBack('Btn_Pb','Click')@/SCRIPT>"

You're already in code-behind here - why don't you just call Btn_Pb's Click
code...?
 

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

Top