【previouspage】如何用PreviousPage跨页面传值?_previouspage

分类: 小知识

【previouspage】如何用PreviousPage跨页面传值?_previouspage

【previouspage】如何用PreviousPage跨页面传值?_previouspage

话题:previouspage,兴趣爱好

protectedvoid(objectsource,RepeaterCommandEventArgse)
{
if(e.CommandName=="UpImage"){
stringstrindex=e.CommandArgument.ToString();
//DimresultAsString=""
//Page.PreviousPage.FindControl("txtTutorId1").value=strindex
//这里如何关闭弹出的窗口???
TextBoxtxtName=(TextBox)Page.PreviousPage.FindControl("txtTutorId1");
//CType(PreviousPage.FindControl("txtTutorId1"),TextBox).Text=strindex
txtName.Text=strindex;
}
}
提示错误:Objectreferencenotsettoaninstanceofanobject
TextBoxtxtName=(TextBox)Page.PreviousPage.FindControl("txtTutorId1");
怎样为前一页的txtTutorId1的text赋值啊
我已经设置了PreviousPageTypeVirtualPath

提示错误:Objectreferencenotsettoaninstanceofanobject
我只知道可以获取前一个页面的表单。
要修改前一个页面的控件值,应该要新的请求吧,我是这么认为的
我一般是选建抽象类BasePage继承Page。
需要跨页面控件对象写一些抽象索引如:
publicabstractclassBasePage:System.Web.UI.Page
{
publicabstractTextBoxtxtUserName
{
get;
}
publicabstractTextBoxtxtPassword
{
get;
}
}
Button的PostBackUrl="~/XXXXXX.aspx"属性,传到哪一个页面的属性设成目标页面。并实现抽象方
如:
publicoverrideTextBoxtxtUserName
{
get{returnthis.txt_username;}
}
publicoverrideTextBoxtxtPassword
{
get{returnthis.txt_pwd;}
}
目标页面的代码放
你就可以通过this.PreviousPage得到上个页面传过来的值了。。

关注
翻译过来是:未将对象引用设置到对象的实例。
解决办法,在发送页面就不要用Response.Redirect("url");
而是用PostBackUrl属性传递网页地址。
发送页面不要使用
Response.Redirect("~/xxxx.aspx");
而使用Button的PostBackUrl属性。
前面的页面Button的PostBackUrl属性设置为当前页面就行了
点击该上一页的Button就不会出现:未将对象引用设置到对象的实例。



'Text="選擇..."/>
我用的是linkbutton

分享:洛尔卡尼的尸体 > 【previouspage】如何用PreviousPage跨页面传值?

--免责声明-- 《【previouspage】如何用PreviousPage跨页面传值?_previouspage》是一篇非常优秀的文章,文笔优美俱佳,如果《【previouspage】如何用PreviousPage跨页面传值?_previouspage》这篇文章结尾注明了由本站原创,那么《【previouspage】如何用PreviousPage跨页面传值?_previouspage》版权就属于本站,如果没有注明那么《【previouspage】如何用PreviousPage跨页面传值?_previouspage》这篇文章则转载于网络,或者由本站会员发表,版权归原作者,只代表作者观点和本站无关,如果您认为《【previouspage】如何用PreviousPage跨页面传值?_previouspage》这篇文章侵犯了您的权益,请联系我们删除,我们会在看到第一时间删除《【previouspage】如何用PreviousPage跨页面传值?_previouspage》这篇文章828la6305。

【结语】:【previouspage】如何用PreviousPage跨页面传值?_previouspage(全文完),小编在下方为大家整理了更多好看的相关文章,希望大家能够喜欢。
【温馨提示】:早睡早起,按时吃饭,多运动,每天开心学习和工作,做个健康的正能量人士。

更多【【previouspage】如何用PreviousPage跨页面传值?_previouspage】推荐文章

<small id='828la6305'></small><noframes id='828la6305'>

  • <tfoot id='828la6305'></tfoot>

      <legend id='828la6305'><style id='828la6305'><dir id='828la6305'><q id='828la6305'></q></dir></style></legend>
      <i id='828la6305'><tr id='828la6305'><dt id='828la6305'><q id='828la6305'><span id='828la6305'><th id='828la6305'></th></span></q></dt></tr></i><div id='828la6305'><tfoot id='828la6305'></tfoot><dl id='828la6305'><fieldset id='828la6305'></fieldset></dl></div>
          <bdo id='828la6305'></bdo><ul id='828la6305'></ul>