Web用户控制问题 [英] Web User Control Issue

查看:77
本文介绍了Web用户控制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在单个"aspx"页面中设计和访问了大约10个用户控件.

每个用户控件都具有!IsPostback"条件的页面加载事件,在该事件中我将详细信息绑定到Grid View.

我基于相应的菜单/按钮单击访问控件,以将该控件加载到aspx页面上.但是在单击菜单或按钮时,"IsPostback"为"true",并且在加载控件时,用户控件中可用的网格视图未绑定.

那么如何在加载用户控件时将IsPostBack设置为false?还是有其他解决方案来解决此问题?

请回复.紧急.

问候,
Rashmi.MK

Hi,

I have around 10 User Controls designed and accessed in Single "aspx" page.

Each User Control has Page Load event with "!IsPostback" condition where I am binding details to Grid View.

I access controls based on respective menu/button click to load that control on aspx page. But on Click of menu or button "IsPostback" is "true" and Grid view available in User Control is not binding when control is loaded.

So how can I make IsPostBack as false while loading User Control? Or is there any other solution to solve this problem?

Please reply. Its Urgent.

Regards,
Rashmi.MK

推荐答案

因此,您想在Gridview视图中显示数据库,因此页面内加载调用Gridview()函数.
So u want to display database in Gridview view So inpage load calls the function of Gridview().
void loadgrid()
{
ds=new dataset()
ad=new sqldataadapter("select * from table",con);
ad.fill(ds);
gridview1.datasource=ds;
gridview1.databind();
}


在页面加载中调用loadgrid函数.


call the loadgrid function in page load.


在所有工作完成后调用girdload方法onclick按钮事件
像:
call you girdload method onclick button event after all work finish
like:
void button_click(sender sender,enentargs e)
{
   --your code here
   -- now call your method here
}


在pageLoad中放置一个断点.有时VS可能会引起问题.或检查您是否确实在PageLoad中调用了该函数.
Put a break point in pageLoad. Sometimes VS may raise a problem. Or Check that you have actually called the function in PageLoad or not.


这篇关于Web用户控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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