Sorry for the wordy title, but it seemed the best way to describe the issue.
Basically, we have a WebDropDown inside an update panel, whose current value we want to change depending on what WebTab is loaded. We've tried handling the WebTab SelectedIndexChanged event to modify this value, but the update panel doesn't get an Async postback triggered. This is after adding the WebTab as an async postback trigger inside the UpdatePanel too.
I finally got it to work by calling __doPostBack via clicking a button on the ClientEvents-SelectedIndexChanged event, but now I'm presented with this error everytime I change a tab:
Error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: type
Any ideas as to what is causing this issue?
Again, I can't thank you enough!
I think I've drilled down to the root of the issue. Having a WebDataGrid in one of the ContentTabs seems to be causing the issue.
Even just putting an empty WebDataGrid into a ContentTabItem, then clicking that tab, causes the following error:
Line: 4620Error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: type
Again, this WebDataGrid is completely empty, and has been dragged and dropped from the toolbox and nothing else.
Without the WebDataGrid, everything works fine. Is this an issue with the WebDataGrid, or is there some underlying problem in our code? Again, the given WebTab options work fine without the WebDataGrid, so I'm assuming it's something wrong with how the WebDataGrid is set up.
Thanks again for all your help!
Hello Alex,
Currently there Is no way to achieve the mention events order, The reason is that the client side is the one that requests some job to be done on the server. This is the reason why client side events are fired before the server side events.
However, I modified the sample project in order to achieve only async postbacks . What I am doing is to call __doPostBack for the WebDropDown using __doPostBacks function`s parameters. With setting WebDropown as __EVENTTARGET I am causing async postback for the WebdropDown respectively for the updatePanel. Some further reference about __doPostBack function and its parameters could be found at:
http://aspalliance.com/articleViewer.aspx?aId=895&pId=-1
Now in my scenario async postback is triggered when ActiveTabChange event is fired and WebDropDown`s selected index is changed. For example:
Client side: <script type="text/javascript" id="igClientScript1"> function causePostBack() { __doPostBack('WebDropDown1', ' '); } function WebTab1_ActiveTabChange(sender, eventArgs) { causePostBack(); } </script> Server side: protected void WebTab1_SelectedIndexChanged(object sender, TabSelectedIndexChangedEventArgs e) { int index = e.NewIndex; this.WebDropDown1.SelectedItemIndex = index; }
Client side:
<script type="text/javascript" id="igClientScript1">
function causePostBack() {
__doPostBack('WebDropDown1', ' ');
}
function WebTab1_ActiveTabChange(sender, eventArgs) {
causePostBack();
</script>
Server side:
protected void WebTab1_SelectedIndexChanged(object sender, TabSelectedIndexChangedEventArgs e)
{
int index = e.NewIndex;
this.WebDropDown1.SelectedItemIndex = index;
I hope you find this information helpful.
Please let me know if you need any further assistance with this matter.
Main problem is that we need to have AJAX enabled, otherwise the WebDataGridView loses it's content after loading another tab. The problem with having the client side selectedindexchanged is that it seems to do the postback before the server side, which results in no data being loaded. Is there any way to say in the javascript, "Wait until the server side SelectedIndexChanged event has finished doing it's processing, THEN do some stuff"?
Thanks again for your continued support!
From the looks of it though, that button still causes a full postback? I need the WebDropDown to be updated WITHOUT full postback, and I need it updated after a partial postback from the WebTab. Also note that we have the EnableLoadOnDemand set to true, which seems to cause issues with this.
I'll double check the sample with out project, but from what I can see, it's still doing a full postback
EDIT: this is also being done within an ASP:content page, which inherits from a Master page. Does that change the setup? Still getting a null reference javascript error after implementing your solution into our project
ANOTHER EDIT: seems having AJAX enabled for the WebTab is causing issues also
Thank you for getting back to me.
I set the AutoPostBackFlags to Async, Afterwards I am handling client side ActiveTabChange event. In this event I am triggering a click for the button and everything works as expected, a click is triggered, respectively a postback is fired and selected index of the WebdropDown is changed. Please keep in mind that the EnabledActivation property or WebTab should be set to true in order to fire this event. For example:
function WebTab1_ActiveTabChange(sender, eventArgs) { document.getElementById("Button2").click(); }
function WebTab1_ActiveTabChange(sender, eventArgs)
document.getElementById("Button2").click();
I modified my sample and I am attaching it for your reference.
Please let me know if you have any additional questions regarding this matter.