using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Web.Script.Services;
using System.Data.SqlClient;
using System.Data;
using ResMangSys.DAL.NetResLedgTableAdapters;
using System.Web.UI.HtmlControls;
// 下载于www.51aspx.com
namespace ResMangSys
{
    public partial class SingleBaStaQuery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                //baStaNametxt.Text.Trim();
                if (baStaNametxt.Text.Trim() != "" && baStaIdddl.SelectedItem.Text == "--请选择--")
                {
                    RepNetResLedg.DataSourceID = "ODSNetResLedgByName";
                    RepNetResLedg.DataBind();
                    RepNetResChg.DataSourceID = "ODSNetResChgByBaStaName";
                    RepNetResChg.DataBind();
                }
                else if (baStaIdddl.SelectedItem.Text != "--请选择--")
                {
                    baStaNametxt.Text = "";
                    RepNetResLedg.DataSourceID = "ODSNetResLedgById";
                    RepNetResLedg.DataBind();
                    RepNetResChg.DataSourceID = "ODSNetResChgByBaStaId";
                    RepNetResChg.DataBind();
                }
                else
                {
                    RepNetResLedg.DataSource = null;
                    RepNetResLedg.DataBind();
                    RepNetResChg.DataSource = null;
                    RepNetResChg.DataBind();
                }
                //HtmlAnchor alink = (HtmlAnchor)RepNetResChg.FindControl("alink");
                //HtmlTableCell tdBaStaId = (HtmlTableCell)RepNetResChg.FindControl("tdBaStaId");
                //if (alink != null&&tdBaStaId != null)
                //{
                //    string path = Server.MapPath("~/NetResChg.ashx");

                //    alink.Attributes["href"] = path + "?bastaid=" + tdBaStaId.InnerText;
                //}
            }
        }

        //protected string getBaStaId()
        //{
        //    HtmlTableCell tdBaStaId = (HtmlTableCell)RepNetResChg.FindControl("tdBaStaId");
        //    if (tdBaStaId != null)
        //    {
        //        return tdBaStaId.InnerText;
        //    }
        //    return "";
        //}
    }
}