开发者

Object reference error

开发者 https://www.devze.com 2023-04-09 05:21 出处:网络
I have this piece of code:- What I want is that in button click i want put some value in user control.

I have this piece of code:- What I want is that in button click i want put some value in user control. I get Object reference error.

if (Page.FindControl("pr1") is Control)
{
    Control previewControl = Page.FindControl("pr1");
    Label titleLabelPreview = (Label)previewControl.FindControl("titleLabel");
    titleLabelPreview.Text 开发者_如何学Go= emptxt.Text;

However, if i used it through master page it can not intialized but if i use parent page it work properly. But here, one more problem persisted, suppose the scenario use a tab container where is 3 tab panel in first panel i used a button when i click that button i want to change the tab panel view means 2nd panel but without refresh the page. and one important thing i don't want to use update panel on tab container. I do not wish to use ajax or javascript. any insight on this. Also, would be really great if someone gives me a deep idea how to resolve object reference errors. I read a few blogs like:_

http://www.mikesdotnetting.com/Article/62/Object-reference-not-set-to-an-instance-of-an-object-and-INamingContainer

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.passwordrecovery.usernametemplate.aspx

however, was not fully satisfied.

0

精彩评论

暂无评论...
验证码 换一张
取 消