Textbox lost its value in postback in Modal Popups

I use the inline option for a fancybox, which is a jquery modal popup
in the modal inline div, I have a asp.net formview
everything works fine except the formview insert mode.

I have one textbox inside of formview(insert mode)
the textbox will lose its value whenever I click the "insert button"

if i disable the modal script, the problem will go away

any idea?
tks
LVL 3
joeyluAsked:
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.

tdotCommented:
Can we see the code
0
joeyluAuthor Commented:
i shrink the code a bit, basically it looks like this

I use the fancybox as modal popup and jquery framework at head
I use the masterpage

   <script src="style/jquery.min.js" type="text/javascript"></script>
    <script src="style/jquery.fancybox-1.3.1.pack.js" type="text/javascript"></script>
    <link href="style/jquery.fancybox-1.3.1.css" rel="stylesheet" type="text/css" />

now in the content placeholder: I have a fancybox modal popup trigger, and i have a formview bind with objectdatasource, and a textbox, a button inside of the formview

<asp:Content ID="Content1" ContentPlaceHolderID="CategoryAdmin" Runat="Server">
   <a href="#data">Fancybox trigger</a>
   <div id="#data">
      <asp:FormView ID="FormView1" runat="server" DataKeyNames="sID" DataSourceID="ODS_123">
           <InsertItemTemplate>
                  <asp:TextBox ID="TextBox" runat="server" Text='<%# Bind("content") %>'  />
                  <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" />
           </InsertItemTemplate>
     </asp:FormView>
      <asp:ObjectDataSource ID="ODS_123" runat="server" InsertMethod="Insert"
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetAll"
                TypeName="TableAdapter">
            <InsertParameters>
                <asp:Parameter Name="sID" Type="Int32" />
                <asp:Parameter Name="content" Type="String" />
            </InsertParameters>
            </asp:ObjectDataSource>
   </div>
</asp:Content>

It works perfectly fine if the formview is outside of that modal popup DIV, but within that DIV, it can't pass any value of that TextBox, always become Null when I click the insert button

any idea?
0
yogi4lifeCommented:
ASP.NET has the VIEWSTATE to communicate between client-side form and the server-side code...

Most likely in fancybox nothing with the viewstate is disrupted and information gets passed correctly.

But - when turning on modal fancybox is doing something more "fancy" so the manipulated form field looses connection with the viewstate and hence the server-side code doesnt get anything passed... it looses content...

You will have to inspect your real HTML (HTML source in the browser) running both with and without modal turned on.

Then you will have too look for how the form field is wrapped before it is submitted. That should give you a clue.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

joeyluAuthor Commented:
my ugly solution is to make a control hidden outside of the modal div, and use javascript to pass the textbox(inside of the formview) value to that control, then retrieve the value from the formview inserting event.
well, it's way to complicate and ugly, there has to be an easy solution for this

one answer i've found online is that when the modal popup enabled (not only fancybox, any ajax modal control), the textbox value was misleading to the parent page instead of current page, could that be a case?
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
yogi4lifeCommented:
Do you have any idea if the modal box might not be a child element of the form? If so some code to move it into the form might do the trick...
0
joeyluAuthor Commented:
I use master page
The content page structure looks like this:

Content
   div for modal
      Formview
         Textbox
      /Formview
   /div
/content

This Textbox will not pass the value in formview insert event

however, if I pass this Textbox value to an outside Textbox, and retrive its value at insert event, it works

Content
      textbox hidden
      div for modal
      Formview
         Textbox
      /Formview
   /div
/content
0
yogi4lifeCommented:
I am sorry but I don't have any suggestion for an elegant solution for this...
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
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.