Beispiel #1
0
        /// <summary>
        /// Handles the RowDataBound event of the gvLookup control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
        protected void gvLookup_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string PK = string.Empty;

                if (AttributeName.ToUpper().EndsWith(".TITLE"))
                {
                    PK = e.Row.Cells[1].Text.Trim();
                }
                else
                {
                    PK = e.Row.Cells[0].Text.Trim();
                }

                e.Row.Attributes.Add("onClick",
                                     "ChangeRowColor('" + gvLookup.ClientID + "','" + e.Row.RowIndex + "','" +
                                     _hdnLookupId.ClientID + "','" + _btnSelect.ClientID + "','" + AttributeName + "','" + PK + "')");

                if (AttributeName.ToUpper().EndsWith(".TITLE"))
                {
                    e.Row.Attributes.Add("ondblclick", "Javascript:__doPostBack('myDblClick','" + e.Row.Cells[1].Text.Trim() + "~" + e.Row.RowIndex + "~" + AttributeName + "');");
                }
                else
                {
                    e.Row.Attributes.Add("ondblclick", "Javascript:__doPostBack('myDblClick','" + e.Row.Cells[0].Text.Trim() + "~" + e.Row.RowIndex + "~" + AttributeName + "');");
                }
            }
        }