Example #1
0
    private void GenTableData()
    {
        BasicData bd = new BasicData();

        string totalRecord = "";

        DataTable dt = bd.GetApUser(txtUserDesc.Text, txtEmail.Text, ddlFact.SelectedValue, PageControl1.StartRecord.ToString(), PageControl1.PageSize.ToString(),ref totalRecord);

        SetPageControl(totalRecord, PageControl1.CurrentPage);

        string cssClass = "";

        int i = 0;
        foreach (DataRow dr in dt.Rows)
        {
            if (i % 2 == 1) cssClass = "cssGridRowAlternating";
            else cssClass = "cssGridRow";

            i++;

            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();

            cell.Text = i.ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["emp_no"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["email"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["user_desc"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            cell = new TableCell();
            cell.Text = dr["fact_no"].ToString();
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            string rowID = "R" + dr["user_id"].ToString().Split('.')[0];

            Image imgDetail = new Image();
            imgDetail.Style["cursor"] = "pointer";
            imgDetail.ImageUrl = "~/Images/arrow_down.gif";
            imgDetail.Attributes.Add("onclick", "ShowDetail('" + rowID + "','" + dr["user_id"].ToString() + "');");

            cell = new TableCell();
            cell.Controls.Add(imgDetail);
            cell.CssClass = cssClass;
            row.Cells.Add(cell);

            mTable.Rows.Add(row);

            #region Row Details
            row = new TableRow();
            row.ID = rowID;
            row.Style["display"] = "none";

            cell = new TableCell();
            cell.ColumnSpan = 6;
            cell.CssClass = cssClass;
            cell.HorizontalAlign = HorizontalAlign.Center;
            row.Cells.Add(cell);
            mTable.Rows.Add(row);
            #endregion
        }

        if (dt.Rows.Count == 0)
        {
            TableRow row = new TableRow();
            row.HorizontalAlign = HorizontalAlign.Center;
            TableCell cell = new TableCell();
            cell.Text = "No Data";
            cell.CssClass = "cssGridRow";
            cell.ColumnSpan = 6;
            row.Cells.Add(cell);
            mTable.Rows.Add(row);

        }
    }
 private void LoadUserInfo()
 {
     BasicData bd = new BasicData();
     DataTable dtInfo = bd.GetApUser(Request.Params["user_id"]);
     lbUserDesc.Text = dtInfo.Rows[0]["user_desc"].ToString();
     lbFact_no.Text = dtInfo.Rows[0]["fact_no"].ToString();
     lbEmail.Text = dtInfo.Rows[0]["email"].ToString();
     lbEmp_no.Text = dtInfo.Rows[0]["emp_no"].ToString();
 }