SharePoint 2010可视化Webpart页面加载问题 [英] SharePoint 2010 visual webpart page load issue
问题描述
I am working on SharePoint 2010 visual webpart for the first time. I have some functions called on page load that gets value from list and then set variable values inside the "if (!IsPostBack){}" method.
单击按钮时,当我检查在页面加载中设置的变量值时,变量没有值.我已经在ASP更新面板中添加了所有控件.我尝试使用ViewState和httpContext,但没有任何效果.
On button click, when I check the variable values that I set on page load the variables has no value. I have add all the controls in the asp update panel. I tried using ViewState as well as httpContext but nothing worked.
如果我删除了"if(!IsPostBack)",它之所以有效,是因为它在单击按钮时再次调用了页面加载事件.
If I remove the "if (!IsPostBack)" it works since it calls the page load event again on button click.
任何帮助表示赞赏.
莫纳利
推荐答案
请检查以下MSDN文章中的示例:
Please check the example in the MSDN article below:
在SharePoint 2010中创建可视Web部件
https://msdn.microsoft.com/zh-我们/library/office/ff597539(v=office.14).aspx
或者我建议您在可能的情况下提供完整的代码,这将使问题更易于研究.
Or I suggest you provide the complete code in use if possible, which should make the issue easier to be researched.
最好的问候,
丹尼斯
这篇关于SharePoint 2010可视化Webpart页面加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!