views:

367

answers:

2

I have a div on the aspx page in which I have created an onClick event. The onClick for the div points to:

onclick="'javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton", "", true, "", "", false, false))'"

The above link so happens to be the onClick for the StepNext button on the page. I have removed that button's visibility, and hence want to permit it so that when I click on this div it would goto the next step.

However, it doesn't work? The browser does nothing. Is there a way I can goto the next step from the aspx page?

EDIT: Here is some additional code:

The div (note: I tried with the exact onClick of the code below it, and does not work either):

            <div id="Box1" class="BoxUploadStyle"  onmouseover="this.style.backgroundImage='url(../IMG/box1_over.gif)';this.style.cursor='hand';this.style.cursor='pointer';" 
                onmouseout="this.style.backgroundImage='url(../IMG/box1.gif)';" 
                onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('Box1', '', true, '', '', false, false))">  
            <h3><a href="#">Simple Upload</a></h3> 
            Upload upto 10 files each time.
            </div>

Here is the code for the button Next and Previous (from the View Source - since it is part of the wizard):

</tr><tr>
     <td align="right">
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepPreviousButton" value="Previous" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepPreviousButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
            <input type="submit" name="ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton" value="Next" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_ContentPlaceHolder1_Wizard1_StepNavigationTemplateContainerID_StepNextButton" style="color:#284E98;background-color:White;border-color:#507CD1;border-width:1px;border-style:Solid;font-family:Verdana;font-size:0.8em;" />
        </td>
A: 

I can see 2 issues which might cause your javascript not to run:

  1. You are double quoting your javascript string: you have:

    onclick="'javascript:...'"

and it should be:

onclick="javascript:..."

or

onclick='javascript:...'

Also, you shouldn't use the " html entity in javascript to indicate a quote, you should just use quotes (just make sure you use the opposite of the one you use to surround the entire javascript line).

try changing your code line to this:

onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton', '', true, '', '', false, false))"
free-dom
thanks for your reply, but still nothing happens. I tried all your suggestions, but still same problem: nothing happens.
waqasahmed
also, verify that an object with the id: ctl00$ContentPlaceHolder1$Wizard1$StepNavigationTemplateContainerID$StepNextButton exists on your page.
free-dom
That is the reference to the Next button. I hide that. But even when the visibility is shown, clicking the div does nothing. Even giving the div an id of say box1 and replacing that text with 'box1' does nothing (box1 does appear in the Page source as the ID for that div)
waqasahmed
any more ideas??
waqasahmed
A: 

wizard button Next has type="submit"

So, in your javascript code after WebForm_DoPostBackWithOptions you need to call document.forms[0].submit();

Sunligth