使.aspx页的变量后面的代码公开 [英] making code behind variable public for .aspx page

查看:57
本文介绍了使.aspx页的变量后面的代码公开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家,

我今天是Satardekar,
在我的asp.net c-sharp应用程序中,我正在从Datatable resultTable 中的mysql数据库中获取记录.我已经在(.aspx.cs)页面后面的代码中编写了此代码.

由于结果是动态的,因此我在.aspx设计页面中使用html表格式显示了这些结果.为此,我将隐藏代码的resultTable公开制作为public,以便在.aspx html页面中重复使用.

它对我有用.

是否公开是正确的选择?会减少加载时间吗?
任何其他解决方案都可以.
在此先感谢..................

Hi Expert,

I am uday Satardekar,
In my asp.net c-sharp application,I am fetching records from mysql database in Datatable resultTable . I have written this code in code behind( .aspx.cs) page.

As the results are dynamic , i am showing these result using html table format in .aspx design page.For this reson, i made resultTable from code behindpage as public to reuse it in .aspx html page.

its working for me.

For making public is right approch or not? will it reduce loading time ?
any other solution is appreciable.
Thanks in advance..................

推荐答案

最好使用protected,因为它只是被称为inn从aspx.cs继承的.aspx页


您可以使用会话的其他方式来存储表...............
it is better to use protected as it is just called inn the .aspx page which is inherited from aspx.cs


Other way you can use the session to store your table..............


您可以使用受保护的变量来存储结果集
You can use protected variable to store the resultset


这篇关于使.aspx页的变量后面的代码公开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆