Пример #1
0
        protected void gvResult_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            PubCollection dt = ((PubCollection)this.gvResult.DataSource);

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Pub l_pub = dt[e.Item.ItemIndex];
                ////delete btn col
                Panel l_pnl = e.Item.Cells[3].Controls[1] as Panel;
                ((Label)l_pnl.Controls[1]).Text = "Are you sure you want to delete this related publication<br />[" + l_pub.ProdID + @" - " + l_pub.Name + "]?";
            }
        }
Пример #2
0
 protected void BindData()
 {
     if (this.PubID > 0)
     {
         PubCollection p = PE_DAL.GetRelatedPubDisplay(this.PubID);
         if (p.Count > 0)
         {
             this.gvResult.DataSource = p;
             this.gvResult.DataBind();
         }
         else
         {
             this.gvResult.Visible   = false;
             this.lblErrRelProd.Text = "This publication does not have any other related publication recorded.";
         }
     }
 }
Пример #3
0
        protected void gvResult_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            PubCollection dt   = ((PubCollection)this.gvResult.DataSource);
            HyperLink     l_hl = new HyperLink();

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                CheckBox l_chkbox = (CheckBox)e.Row.FindControl("chkSelect");
                if (Request.Browser.MSDomVersion.Major == 0) // Non IE Browser?)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                            "myScript",
                                                            " function HighlightSelected(colorcheckboxselected, RowState) { if (colorcheckboxselected.checked) colorcheckboxselected.parentNode.parentNode.style.backgroundColor='#FFAA63'; else { if (RowState=='Normal') colorcheckboxselected.parentNode.parentNode.style.backgroundColor='white'; else colorcheckboxselected.parentNode.parentNode.style.backgroundColor='#D6E3F7'; } }"
                                                            , true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(),
                                                            "myScript",
                                                            " function HighlightSelected(colorcheckboxselected, RowState) { if (colorcheckboxselected.checked) colorcheckboxselected.parentElement.parentElement.style.backgroundColor='#FFAA63'; else { if (RowState=='Normal') colorcheckboxselected.parentElement.parentElement.style.backgroundColor='white'; else colorcheckboxselected.parentElement.parentElement.style.backgroundColor='#D6E3F7'; } }"
                                                            , true);
                }
                l_chkbox.Attributes.Add("onclick", "HighlightSelected(this,'" + Convert.ToString(e.Row.RowState) + "' );");

                Pub l_pub = dt[e.Row.DataItemIndex];

                /*if (e.Row.RowIndex % 2 == 0)
                 * {
                 *  e.Row.Style["color"] = "#0000ff";
                 * }
                 * else
                 * {
                 *  e.Row.Style["color"] = "#00bb00";
                 * }*/

                l_hl.Text        = l_pub.Name;
                l_hl.NavigateUrl = "~/PubRecord.aspx?mode=edit&pubid=" + l_pub.PubID;

                e.Row.Cells[3].Controls.Add(l_hl);
            }
        }