|
-
Sep 17th, 2008, 10:06 AM
#1
Thread Starter
Lively Member
[RESOLVED] Ajax TabContainer problem
Hi,
(this is actually MOSS 2007 question. I don't know where to post it exactly)
I am developing a webpart with Ajax TabContainer within an UpdatePanel. I developed an web application and tried my code there first everything works fine. Then I added the same to a webpart, deployed it and tested. The tabcontainer displays well. The control is supposed to load data dynamically on tabchange with a postback. But it is not doing so in my sharepoint site where as it works in web application. I am using C# 2.0
Then I went to view source of both the pages and detected the problem. It is all about the client ID of the tabcontainer. I am registering some script to the page as follows:
StringBuilder sbScript = new StringBuilder();
sbScript.Append("<script type=\"text/javascript\">");
sbScript.Append("function ActiveTabChanged(sender, e) {");
sbScript.Append("__doPostBack("+tabcontainer.ClientID +", sender.get_activeTab().get_headerText()) }");
sbScript.Append("</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "ScriptToRSSTabChange", sbScript.ToString(), false);
When I view source:
the script is registered as:
sbScript.Append("__doPostBack('tabcontainer', sender.get_activeTab().get_headerText()) }");
In my web application tabcontainer.ClientID is "tabcontaner" so the script works fine and the control postsback and gets the data. But in my sharepoint site the tabcontainer.ClientID is something like "someGUID_tabcontainer" which is not the same as the one registered in the script. so the tabcontainer is making complete page postback instead of partial postback and therefore looses it's viewstate.
I tried with tabcontainer.UniqueID and also <%=tabcontainer.ClientID%> in the script. but of no use.
While using <%=tabcontainer.ClientID%>, if I use '<%=tabcontainer.ClientID%>' the script gets registered as
sbScript.Append("__doPostBack('<%=tabcontainer.ClientID%>', sender.get_activeTab().get_headerText()) }");
if I don't give single quote or double quote, the tabcontainer is not getting diplayed at all
Any suggestions please.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|