Javascript popup need to open only on onload event of asp.net page

I called a popup window on onload event of a asp.net page.In the page I have a gridview including linkbutton coliumn. When I click on link button of gridview popup window again opens, while I want that it open only when I open page first time .
konfusionAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
Change you link button from ASP.net type to simple html button and place a onClick to it

OR

on the link button just write onClick=" return false;" at the end. Can you paste you code of link button if you dont understand what i mean to say?
0
konfusionAuthor Commented:
ya sure
<ItemTemplate>
                                <asp:LinkButton ID="lnkParticipantId" runat="server" CommandArgument='<%# Eval("participantid") %>'
                                    CommandName="SetLabel"><%# Eval("participantid")%></asp:LinkButton>
                            </ItemTemplate>

this commandname "setlabel" i m accessing in cs file as -
protected void PatientSearchResults_RowCommand(Object sender, GridViewCommandEventArgs e)
        {
            if (IsPostBack)
            {
                if (e.CommandName == "SetLabel")
                {
                    divQuestion.Visible = true;
                }
            }
            else
            {
                divQuestion.Visible = false;
            }
        }
}
0
Ashish PatelCommented:
Basically what is happening here is when  you click the asp:LinkButton it post's back the request and after processing the action of link button the page is reloaded. So, here may be you can remove the onLoad from the <body tag and in the code behind, when its IsPostBack == false at that time you execute the script of the page at the end. Something like this in the Page_Load should be there.

if (!IsPostBack)
     Page.ClientScript.RegisterStartupScript(Me.GetType(), "onload", "<script>ONLOADFUNCTION();</script>")

Note: Please change the ONLOADFUNCTION with the function which you are calling during onload.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
konfusionAuthor Commented:
Ya it works...
Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.