DropDownList问题需要帮助和输入 [英] DropDownList Problem Need Help and Input

查看:72
本文介绍了DropDownList问题需要帮助和输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我有一个报表的表格。在表单上我有6个DropDownList。 DropDownList的主要名称是Schools。其他五年是年。我想要做的是从DropDownListSchools中选择一所学校,并根据该选择DropDownListYear将填充年份。当我把DropDownListyear数据化时,它来自所有学校的所有年份,并没有办法告诉哪一年属于哪所学校。所有的学校都有身份证。有人可以帮我看看我哪里出错了吗?我错过了什么代码?



Hello. I have a form that does reports. On the form I have 6 DropDownList. The main DropDownList name is Schools. The other five are years. What I want to do is to select a school from the DropDownListSchools and based on that selection the DropDownListYear will populate with the years. When I Databound the DropDownListyear it came with all the years from all the schools and no way to tell which year belongs to which school. All of the schools have an ID also. Can someone help me to see where did I go wrong? What code am I missing?

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing.Printing;
public partial class SchoolReports : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void DropDownListSchools_SelectedIndexChanged(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PassConnectionString"].ConnectionString);
        con.Open(); 
    }
    protected void DropDownListCFY1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListCFY2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListCFY3_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListCFY4_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListCFY5_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListFY1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListFY2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListFY3_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListFY4_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownListFY5_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}

推荐答案

DropDownListSchools_SelectedIndexChanged 函数在其他下拉列表中执行您想要的操作!



您只是没有处理其他DDL的代码
In the DropDownListSchools_SelectedIndexChanged function perform the actions you want on the other dropdownlists!

You just don't have any code there that handleds the other DDLs


这篇关于DropDownList问题需要帮助和输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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