예제 #1
0
    private void BindData()
    {
        // 数据库中的表: ID, PageName, ResourceName, ResourceUrl

        DataTable dt = new DAL.Tables.T_PageResources().Open("distinct PageName", "", "");

        if (dt == null)
        {
            return;
        }

        if (dt.Rows.Count < 1)
        {
            return;
        }


        ddlPageName.Items.Clear();

        ddlPageName.Items.Add(new ListItem("请选择页面", "-1"));

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ddlPageName.Items.Add(new ListItem(dt.Rows[i]["PageName"].ToString(), (i + 1).ToString()));
        }
    }
예제 #2
0
    protected void ddlPageName_SelectedIndexChanged(object sender, EventArgs e)
    {
        ddlResourceName.Items.Clear();
        sfp1.Visible                 = false;
        img1.Visible                 = false;
        btnUpdate.Enabled            = false;
        this.lblDescriptioin.Text    = "";
        this.lblDescriptioin.Visible = false;

        if (ddlPageName.SelectedValue == "-1")
        {
            return;
        }

        // 查找数据库,显示相应文件图片页面路径
        object o = Shove.Database.MSSQL.ExecuteScalar("select top 1 SitePath from T_PageResources where PageName = '" + ddlPageName.SelectedItem.Text + "'");

        if (o != null)
        {
            lblDescriptioin.Text    = "<br/>页面站点相关路径: " + o.ToString();
            lblDescriptioin.Visible = true;
        }
        else
        {
            lblDescriptioin.Text    = "";
            lblDescriptioin.Visible = false;
        }

        DataTable dt = new DAL.Tables.T_PageResources().Open("ResourceName, ResourceUrl", "PageName = '" + ddlPageName.SelectedItem.Text + "'", "ResourceName");

        ddlResourceName.Items.Add(new ListItem("请选择一个资源", ""));

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            ddlResourceName.Items.Add(new ListItem(dt.Rows[i]["ResourceName"].ToString(), dt.Rows[i]["ResourceUrl"].ToString()));
        }
    }