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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Can we see the code
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">
                  <asp:TextBox ID="TextBox" runat="server" Text='<%# Bind("content") %>'  />
                  <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert" />
      <asp:ObjectDataSource ID="ODS_123" runat="server" InsertMethod="Insert"
                OldValuesParameterFormatString="original_{0}" SelectMethod="GetAll"
                <asp:Parameter Name="sID" Type="Int32" />
                <asp:Parameter Name="content" Type="String" />

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?
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.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook 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?

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
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...
joeyluAuthor Commented:
I use master page
The content page structure looks like this:

   div for modal

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

      textbox hidden
      div for modal
I am sorry but I don't have any suggestion for an elegant solution for this...
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

From novice to tech pro — start learning today.