delay the drawing of tables - asp.net
delay the drawing of tables - asp.net

I may be going about this all wrong, but I can't think of an alternative. i have a page with several datatables. Some of them rely on a value from a cookie. I do this in the controller. I have javascript that checks for the cookie and if not set, it displays a form for the user to set the value. The problem is while the form is popped up, the controllers are loading the datatables in the background.
I tried moving the cookie before $(document).ready but the pop-up form needs the document to be drawn. so I have a chicken/egg (or is that a cookie/milk) scenario.
Is there a way to delay the loading of the datatabes until the user clicks submit on the pop-up form? I really hope this post makes sense...it is an ugly scenario.
This question has an accepted answers - jump to answer
Answers
I would put the Datatables init code inside the submit event handler for your form. To keep the event handler clean place the DT init code in a function and call that function in the handler.
Kevin
oh my goodness. that was so simple. sometimes the obvious is right in front of you and you are too busy looking around it for something more complicated.
thanks.
Happens all the time
Kevin