Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Wednesday, March 28, 2012

calling javascript function after asychronous call back event

I have a grid showing a list of records and a 'AddNew' Button on page. When user clicks on 'AddNew' a 'Table' which is not visible by default becomes visible using javascript and setting 'style.visible='visible'' and 'style.display='block'' properties. Now when user enters the data for new listing and click on 'Save Data' button i am sending an aschrounous call back using AJAX tool kit and UpdatePanel. Everything workes fine and record is entered withour complete Page Postback. But after the record is inserted and Grid is refreshed with asychronous postback what i want is to Hide that 'Add New' table and just wanted to show Grid on page. And the problem is i am not able to call the javascript function after asychronous call back which hides the Table.

Any suggestions?

Look into the Sys.WebForms.PageLoadedEventArgs class.

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageLoadedEventArgsClass/default.aspx

(its a lot easier than the docs make it look)

<script type="text/javascript">var postbackElement;Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded); function beginRequest(sender, args) { postbackElement = args.get_postBackElement(); } function pageLoaded(sender, args) { var updatedPanels = args.get_panelsUpdated(); if (typeof(postbackElement) === "undefined") { return; } else if (postbackElement.id.toLowerCase().indexOf(YOURPOSTBACKELEMENT) > -1) { //WHATEVER SCRIPT YOU NEED TO RUN } }</script>

Thankslilconnorpeterson ! your solution worked fine but fortunately i came to know that the problembecomes really simple and there is no need for calling javascript and making a Table Visible/Invisible if i replace the HTML table with server side Panel. Now i can simple make it Visible/Invisible by setting its Visible/Invsible property to true/false in codebehind.

Regards,

Zeeshan Malik

Monday, March 26, 2012

Callbacks in association with Update panel

I've got a Gridview that I've customized with buttons that do callbacks to get context menus and insert stuff in the main Gridview table.

If I put the entire Gridview in an update panel, what is the likelihood that these little custom callbacks will still work? Rephrased: is it a known feature of update panels that they will interfere with, override, or otherwise mess up such callbacks? Or do update panels just respond to submits, or have some other property, that would indicate that they would not interfere with such callbacks?

Any guidance on this would be appreciated ( I hope to have better luck testing this for myself soon.)

Thanks!

hello.

if i'm not mistaken, the scriptmanager intercepts form submission only...


Thanks for the post. That's good news. I'll keep my fingers crossed for the test.

Agradecimento!

Saturday, March 24, 2012

Calender Extenders cssClass problem in Gridview

hi all

i have an HTML table in one of gridview's cell which is always hidden at startup. there is one textbox and one calander extender in that HTML table. In the same cell there is Link Button. On click event of that LinkButton i make that hidden table visible.(this process is done on server side). Problem is that when i perform this operation then after that Calander Extender's css class disturbs and does not show the appropriate design.

i dont know why this problem occured. and now this problem is solved automatically. I havn't done any thing for it.. this is really strangeHuh?

Wednesday, March 21, 2012

CalendarExtender padding within Table

Hi,

I have a Textbox/CalendarExtender in a table, whose td style contains "padding:10px;". When I click in the textbox to open the calendar it appears to be all messed up. On further investigation, it appears to be inheriting the padding from my table. When I remove the "padding:10px;" line from my table style, the calendar displays fine. Has anyone any idea how to override this?

Many thanks,


Simon

What if you set the CssClass property for the CalendarExtender and in the class definition, you set the padding on td:s to 0?