views:

272

answers:

3

Hi, i have following problem, i am using a popup jquery dialog with asp:formview .

the purpose of this popup is for user to enter a hyperlink which is placed then in textbox control in formview

the popup dialog div is located outside a formview just after body tag

    <body style="background-color: #FFFFFF; font-family:Lucida Console;">

        <div id="dialog-form" title="sdfdfsdf" style="font-size:14px; ">
            <form>
            <fieldset>
                <label for="link">sdfdf</label>
                <input type="text" name="sdfsdf" id="link" size="32" />
            </fieldset>
            </form>
        </div>

    <form id="form1" runat="server" style="margin-top:50px;" >
    <div>

        <asp:FormView ID="FormView1"

.......
  <InsertItemTemplate>
   ...
      <sometextbox ...../>
      <button id="create-user" class="ui-state-default ui-corner-all">Create link</button>
   ...
  </InsertItemTemplate>

After clicking a button a popup window is shown BUT the page starts to refresh immediately and of course the popup is then hidden.

If I relocate the button outside the formview - the page is not refreshed, but i need it in formview..

Any idea what to do?

A: 

add the following attribute to the button:

onclick="javascript: return false;"
Hogan
great thx!! it helped!but now i get another problem,i want to pass the value from popup to FreeTextBox controli use folowing codeFTB_API['FreeTextBox1'].SetHtml("link.val()");but the code stucks on this line, it cant find Freetextboxthough if it is outside the formview - everything is fine and value is setif i use document.getElementById('<%=FormView1.FindControl("FreeTextBox1").ClientID%>');iit finds the control but i wonder how can i use SetHtml() method of FreeTextBox in this case..help plz!
qwebek
You have to cast the return value of getElementByID to the JavaScript FreeTextBox type.
Hogan
thx, i will try)
qwebek
A: 

this behavior should not come out because it is a button not submit button.
it seems when it is inside the form view a submit action is attached to it, check your jQuery scripts maybe you mistakenly added onclick submit while attaching the dialog.

Kronass
no, no submit for sure
qwebek
thx for help !1)
qwebek
A: 

clientId must be used

FTB_API['<%=FormView1.FindControl("AdminCommentTextBox").ClientID%>'].SetHtml(...)

thx all for help.

qwebek