aspx页面中的面板问题.和网格 [英] problem with pannel in aspx page. and grid

查看:85
本文介绍了aspx页面中的面板问题.和网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.aspx页面中有两个面板,即panel1和panel2;
我已经将两个面板的页面加载时的可视性属性设置为false,

现在在pannel2上,我有一个文本框,一个按钮和一个网格,

现在,我在按钮clik上写了select qyery,它从(数据库的)表中选择一个值,其中一个列等于我在文本框中输入的值...并在网格中查看结果
我将jst aftr放置在按钮上...

现在的问题是,当我点击按钮时,页面必须回发以在网格中显示结果.但是在页面加载时,我将面板可见性的属性设置为false,这样我就无法在网格中看到结果了. br/>

i have two pannels in .aspx page i.e panel1 and panel2;
i hav set the visibility property to false at page load for both of the pannels ,

now at pannel2 i have a textbox a button and a grid,

now i wrote select qyery at button clik that select the values from table(of databse) where a column equal to a value i have entered in a text box ... and view the results in a grid
i placed jst aftr the button ...

now the problem is that when i clik the button the page has to post back to show the results in grid .. but at page load i set the poperty of pannel visibility to false , so that i cant see my result in grid ..

help me guyz .. what can i do to solve this situation ???

推荐答案

类似于以下内容的事情:

Something along the lines of:

if (!IsPostback)
{
    Panel.Visible = 
        Panel2.Visible = false;
}

// logic to set one or the other panel to visible.


页面回发时,所有控件都将重新初始化.如果您不想重新初始化,请使用IsPostBack

When page get postback all the controls get re-initialise. if you dont want to re-initialise use IsPostBack

If(!IsPostBack)
{
       Panel1.Visible=false;
       Panel2.Visible=false;
}


谢谢
灰烬


Thanks
Ashish


这篇关于aspx页面中的面板问题.和网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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