Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Postback from one webpart to another in SharePoint 2013

$
0
0

I have one webpart with custom TreeView web control (page 1.aspx) and another webpart with LiteralControl (page 2.aspx). When I generate href for LiteralControl to TreeView control on another webpart I have error NullReferenceException. But when previous page is 1.aspx href from 2.aspx work fine. The code for LiteralControl is:

DeptChain.Controls.AddAt(0, new LiteralControl(string.Format("<a href=\"{0}\" target=\"_top\">{1}</a>", HttpUtility.HtmlEncode("javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\"ctl00$ctl51$g_98afd769_f04a_426a_9ada_159f3f9c76d5$avtOrgStructureTree$tvOrgStructure\", \"s75251a5f9a4011dfa9d2002197d2f663\", true, \"\", \"http://test/subweb/1.aspx\", false, true))"), HttpUtility.HtmlEncode(currentTerm.Name))));

webpart on 1.aspx, tvOrgStructure is custom TreeView web control,  param to tvOrgStructure control. 2.aspx opens in modal window.



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>