views:

446

answers:

5

I am trying to implement an Ajax.Beginform on my page but when I try to run the code, on postback I get the following alert

htmlfile: Unknown runtime error

I've tried trawling the web for a solution but no joy so far. Seems the problem is caused uite often by having multiple forms on the page but the Ajax form is the only one I have on there. My code is as below

    <%  Using Ajax.BeginForm("About", New AjaxOptions With {.UpdateTargetId = "divChart"})%>

        <input type="submit" value="ChangeChart" />
        <div id="divChart">
            --Contains html
        </div>
        <%
        End Using%>

Any ideas what could be causing this? Cheers

A: 

Hi, I just want to bump this question, does anyone know why the Ajax.beginform brings back this error in IE8. regards

Israfel
A: 

same here~ who knows the problem?

Will
A: 

hello ,It seems ajax.beginform will bump this if you have more than one form tag out there in same page ,or the action attribute of another form should be set to empty.

bearing09
+1  A: 

for anyone still interested, I dont have/know/understand the solution, but have found what seems to work for my implementation.

For me, moving the div tags (of the section you are trying to replace) outside of the ajaxform declaration seems to fix the problem. So for the above example:

<div id="divChart">
<%  Using Ajax.BeginForm("About", New AjaxOptions With {.UpdateTargetId = "divChart"})%>

        <input type="submit" value="ChangeChart" />

            <!--Contains html -->

        <%
        End Using%>
</div> 

I don't know why. Also I would think this probably wouldn't necessarily get along with the your intended design of the page...

Also this post seems to have some insight.

Hope that helps

rusty
A: 

Hi,

I had a same problem but fortunatelly I was managed to resolve it. I got a same usefull error message like you when I wanted to update an ajax form.

The problem was the following:

The ajax form was in an other "normal" form, and when I removed the "normal" form my application was working properly.

l.