如何将面板隐藏到选定的值 [英] how to hide panel upto selected value

查看:90
本文介绍了如何将面板隐藏到选定的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int count = Convert.ToInt16(ddlvehicles.SelectedValue);
        for (int i = 2; i <= count; i++)
        {
            ((Panel)mvbooking.Views[0].FindControl("Panel" + i)).Visible = true;
        }







这里当我选择值2或更多..在ddl然后面板是可见但当我选择5然后2然后还看到5个面板..



这意味着我想看到面板达到ddl中的选定值...




here when i select values 2 or more.. in ddl then panel is visible but when i select 5 and then 2 then also 5 panels are seen..

it means i want to see panel upto the selected value in ddl...

推荐答案

开发似乎很容易......

您需要隐藏ID比当前所选面板大的面板,以及显示ID'小于或等于当前所选面板的面板。请尝试以下代码:

It seems to be easy to develop...
You need to hide panels which id is bigger then currently selected panel, and show panels which id''s are smaller or equal to currently selected panel. Try below code:
int count = ddlvehicles.Count; //i hope you know how to get count of panels
int cursel = ddlvehicles.SelectedValue; 
for (int i = count; i >2 ; i--)
{
    ((Panel)mvbooking.Views[0].FindControl("Panel" + i)).Visible = (i<=cursel);
}


for(count++;count<=ddlvehicles.Items.Count;count++)
        {
            ((Panel)mvbooking.Views[0].FindControl("Panel" + count)).Visible = false;
        }





在dat代码后写入..



write dis after dat code..


这篇关于如何将面板隐藏到选定的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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