/// <summary> /// Override the render method to add the ability to have the row select in the grid when you click on any part of the row. /// Not sure why such behavior is not supported /// </summary> protected override void Render(System.Web.UI.HtmlTextWriter writer) { foreach (GridViewRow row in gridUsers.Rows) { if (row.RowType == DataControlRowType.DataRow) { // Set the last parameter to True to register for event validation. row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(gridUsers, "Select$" + row.DataItemIndex, true); } } base.Render(writer); }
protected void GRVBiWeekly_RowDataBound(object sender, GridViewRowEventArgs e) { List <string> DecimalCells = new List <string> { "Salary", "Override", "Commission", "Over Pay", "Under Pay" }; CellFormating(ref sender, ref e, DecimalCells); GridView grv = (GridView)sender; e.Row.Attributes["ondblclick"] = ClientScript.GetPostBackClientHyperlink(grv, "Select$" + e.Row.RowIndex); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';"; e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex.ToString()); e.Row.Style.Add("cursor", "hand"); } }
protected override void Render(HtmlTextWriter writer) { foreach (GridViewRow gvrow in GridView1.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { gvrow.Attributes["onmouseover"] = "this.style.cursor='hand';"; gvrow.Attributes["onmouseout"] = "this.style.textDecoration='none';"; gvrow.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + gvrow.RowIndex, true); } } base.Render(writer); }
public void DayDetailsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';"; e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(DayDetailsGridView, "Select$" + e.Row.RowIndex); } e.Row.Cells[0].Visible = false; }
protected void grv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, "select$" + e.Row.RowIndex); for (int columnIndex = 0; columnIndex < e.Row.Cells.Count; columnIndex++) { e.Row.Cells[columnIndex].Attributes["style"] += "cursor:pointer;cursor:hand;"; e.Row.Cells[columnIndex].Attributes["onclick"] = _jsSingle; } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Style.Add("cursor", "pointer"); e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.GridView1, "Select$" + e.Row.RowIndex); } if (e.Row.RowType == DataControlRowType.Header) { GridView header = (GridView)sender; GridViewRow gvr = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); } }
private void RegisterConfirmAlert() { string message = string.Format(GetLocalResourceString("confirm.message", "Delete {0} ({1})?"), selectedItem.Title, selectedItem.Url); ClientScript.RegisterClientScriptBlock(typeof(Delete), "confirm", string.Format(@"jQuery(document).ready( function() {{ if(confirm('{0}')){{ {1}; }}else{{ window.location='{2}'; }} }});", message, ClientScript.GetPostBackClientHyperlink(btnDelete, string.Empty), selectedItem.Url), true); }
protected void gvProperties_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow)) { //e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.originalcolor=this.style.backgroundColor;this.style.background='lightblue';"); // e.Row.Attributes.Add("onmouseout", "this.style.background=this.originalcolor;"); e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this, "gvProperties_" + e.Row.RowIndex.ToString())); if (e.Row.Cells[0].Text == "Password" || e.Row.Cells[0].Text == "PIN") { e.Row.Cells[1].Text = new string('*', e.Row.Cells[1].Text.Length); } } }
protected void gvalltransaction_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //e.Row.Attributes["onmouseover"] = // "javascript:setMouseOverColor(this);"; //e.Row.Attributes["onmouseout"] = // "javascript:setMouseOutColor(this);"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink (this.gvalltransaction, "Select$" + e.Row.RowIndex); } }
protected void GridViewCountries_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "this.style.background='#EEEEEE';this.style.cursor='hand'"; e.Row.Attributes["onmouseout"] = "this.style.background='white'"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink( this.GridViewCountries, "Select$" + e.Row.RowIndex); } }
protected void gvRoyaltors_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[9].Visible = false; LinkButton _dblClickButton = e.Row.FindControl("lnkBtnDblClk") as LinkButton; string _jsDoubleClick = ClientScript.GetPostBackClientHyperlink(_dblClickButton, ""); e.Row.Attributes.Add("ondblclick", _jsDoubleClick); HiddenField hdnRoyaltorLocked = e.Row.FindControl("hdnRoyaltorLocked") as HiddenField; Label lblRoyaltorId = e.Row.FindControl("lblRoyaltorId") as Label; Image imgLock = e.Row.FindControl("imgLock") as Image; if (hdnRoyaltorLocked.Value == "Y") { imgLock.Visible = true; } else { imgLock.Visible = false; } } //JIRA-746 Changes by Ravi on 05/03/2019 -- Start if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[9].Visible = false; foreach (TableCell tc in e.Row.Cells) { if (tc.HasControls() && tc.Controls.Count == 1) { var obj = tc.Controls[0]; LinkButton lnkHeader = (LinkButton)tc.Controls[0]; var hear = lnkHeader.Text; lnkHeader.Style.Add("color", "black"); lnkHeader.Style.Add("text-decoration", "none"); if (lnkHeader != null && hdnSortExpression.Value == lnkHeader.CommandArgument) { // initialize a new image System.Web.UI.WebControls.Image imgSort = new System.Web.UI.WebControls.Image(); imgSort.ImageUrl = (hdnSortDirection.Value == ascending) ? sort_Up : sort_Down; // adding a space and the image to the header link tc.Controls.Add(new LiteralControl(" ")); tc.Controls.Add(imgSort); } } } } //JIRA-746 Changes by Ravi on 05/03/2019 -- End }
protected void DtgViewStage_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get reference to button field in the gridview. LinkButton _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, "Select$" + e.Row.RowIndex); e.Row.Style["cursor"] = "hand"; e.Row.Attributes["onclick"] = _jsSingle; } } }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';"; row.Attributes["onmouseout"] = "this.style.textDecoration='none';"; row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(GridView1, "Select$" + row.DataItemIndex, true); row.Style.Add(HtmlTextWriterStyle.Cursor, "pointer"); } } base.Render(writer); }
protected override void Render(HtmlTextWriter writer) { foreach (GridViewRow gvr in grdUpRelease.Rows) { gvr.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(grdUpRelease, String.Concat("Select$", gvr.RowIndex), true); } foreach (GridViewRow gvr in grdEnvoirnment.Rows) { gvr.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(grdEnvoirnment, String.Concat("Select$", gvr.RowIndex), true); } base.Render(writer); }
protected void grvClientesMorales_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { for (int i = 0; i < iNumero_Columnas_Morales; i++) { e.Row.Cells[i].Attributes["onmouseover"] = "this.style.cursor='pointer';this.style.textDecoration='underline';"; e.Row.Cells[i].Attributes["onmouseout"] = "this.style.textDecoration='none';"; e.Row.Cells[i].Attributes["data-dismiss"] = "modal"; e.Row.Cells[i].Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.grvClientesMorales, "Select$" + e.Row.RowIndex); e.Row.Cells[i].ToolTip = "Seleccionar cliente"; } } }
void grvDepartment_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType != DataControlRowType.Header) { e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(grvDepartment, "$" + e.Row.RowIndex.ToString(), false); } } catch (Exception ex) { oLogger.Log("DepartmentDetails.aspx:grvDepartment_RowDataBound()", ex.Message.ToString()); } }
protected void gv_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[0].Style.Add(HtmlTextWriterStyle.Display, "none"); e.Row.Cells[1].Style.Add(HtmlTextWriterStyle.Display, "none"); } if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[0].Style.Add(HtmlTextWriterStyle.Display, "none"); e.Row.Cells[1].Style.Add(HtmlTextWriterStyle.Display, "none"); e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gvVessel, "Select$" + e.Row.RowIndex); } }
protected void gvSelectionCodes_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = "javascript:SetMouseOver(this);this.style.textDecoration='none'"; e.Row.Attributes["onmouseout"] = "javascript:SetMouseOut(this)"; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(gvSelectionCodes, "Select$" + e.Row.RowIndex); } } catch (Exception ex) { ltlMessage.Text = ex.Message.ToString().ToErrorMessageFormat(); } }
protected void gvObjects_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow)) { e.Row.Attributes.Add("onmouseover", "this.style.cursor='hand';this.style.background='lightblue';"); if (e.Row.RowState == DataControlRowState.Alternate) { e.Row.Attributes.Add("onmouseout", "this.style.background='#fcfcfc url(Images/grd_alt.png) repeat-x top';"); } else { e.Row.Attributes.Add("onmouseout", "this.style.background='none';"); } e.Row.Attributes.Add("onclick", ClientScript.GetPostBackClientHyperlink(this, "gvObjects_" + e.Row.RowIndex.ToString())); } }
protected void grdTournaments_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get the LinkButton control in the first cell var _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; // Get the javascript which is assigned to this LinkButton string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, ""); // Add this javascript to the onclick Attribute of the row e.Row.Attributes["onclick"] = _jsSingle; } }
protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { // Hiding the Select Button Cell in Header Row. e.Row.Cells[0].Style.Add(HtmlTextWriterStyle.Display, "none"); } if (e.Row.RowType == DataControlRowType.DataRow) { // Hiding the Select Button Cells showing for each Data Row. e.Row.Cells[0].Style.Add(HtmlTextWriterStyle.Display, "none"); e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gvList, "Select$" + e.Row.RowIndex); e.Row.Attributes["style"] = "cursor:pointer"; } }
protected void grdUserTeams_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get the LinkButton control in the first cell var _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; // Get the javascript which is assigned to this LinkButton string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, ""); // Add this javascript to the onclick Attribute of the row e.Row.Cells[1].Attributes["onclick"] = _jsSingle; e.Row.Cells[2].Attributes["onclick"] = _jsSingle; //e.Row.Cells[3].Attributes["onclick"] = _jsSingle; //non marked style e.Row.Cells[9].BackColor = Color.LightYellow; e.Row.Cells[10].BackColor = Color.LightYellow; e.Row.Cells[11].BackColor = Color.LightYellow; //is activated already? if (e.Row.Cells[5].Text == "1" || e.Row.Cells[5].Text.ToLower() == "true") { (e.Row.Cells[9].Controls[0] as LinkButton).Text = "Avaktivera"; e.Row.Cells[9].BackColor = Color.LightGreen; } //is marked as paid? if (e.Row.Cells[6].Text == "1" || e.Row.Cells[6].Text.ToLower() == "true") { (e.Row.Cells[10].Controls[0] as LinkButton).Text = "Markera som obetalt"; e.Row.Cells[10].BackColor = Color.LightGreen; } //has bonus points? if (e.Row.Cells[7].Text == "2") { (e.Row.Cells[11].Controls[0] as LinkButton).Text = "Ta bort bonus"; e.Row.Cells[11].BackColor = Color.LightGreen; } } }
protected void gvSupplierSearchList_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[7].Visible = false; LinkButton _dblClickButton = e.Row.FindControl("lnkBtnDblClk") as LinkButton; string _jsDoubleClick = ClientScript.GetPostBackClientHyperlink(_dblClickButton, ""); e.Row.Attributes.Add("ondblclick", _jsDoubleClick); } } catch (Exception ex) { ExceptionHandler("Error in searching supplier data", ex.Message); } }
//protected void gvCatalogueDetails_PageIndexChanging(object sender, GridViewPageEventArgs e) //{ // try // { // if (Session["MissingPartcipantsData"] == null) // return; // DataTable dtMissingPartcipantsData = Session["MissingPartcipantsData"] as DataTable; // gvCatalogueDetails.PageIndex = e.NewPageIndex; // BindGrid(dtMissingPartcipantsData); // } // catch (Exception ex) // { // ExceptionHandler("Error in page change.", ex.Message); // } //} protected void gvCatalogueDetails_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[8].Visible = false; LinkButton _dblClickButton = e.Row.FindControl("lnkBtnDblClk") as LinkButton; string _jsDoubleClick = ClientScript.GetPostBackClientHyperlink(_dblClickButton, ""); e.Row.Attributes.Add("ondblclick", _jsDoubleClick); Label transactionvalue = e.Row.FindControl("lblTransactionValue") as Label; transactionvalue.Text = Convert.ToDecimal(transactionvalue.Text).ToString("0.00"); } //JIRA-746 Changes by Ravi on 05/03/2019 -- Start if (e.Row.RowType == DataControlRowType.Header) { e.Row.Cells[8].Visible = false; foreach (TableCell tc in e.Row.Cells) { if (tc.HasControls()) { LinkButton lnkHeader = (LinkButton)tc.Controls[0]; lnkHeader.Style.Add("color", "black"); lnkHeader.Style.Add("text-decoration", "none"); if (lnkHeader != null && hdnSortExpression.Value == lnkHeader.CommandArgument) { // initialize a new image Image imgSort = new Image(); imgSort.ImageUrl = (hdnSortDirection.Value == ascending) ? sort_Up : sort_Down; // adding a space and the image to the header link tc.Controls.Add(new LiteralControl(" ")); tc.Controls.Add(imgSort); } } } } //JIRA-746 Changes by Ravi on 05/03/2019 -- End } catch (Exception ex) { ExceptionHandler("Error in binding data to grid.", ex.Message); } }
protected void Gridview_RowDataBound1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Get the LinkButton control in the first cell LinkButton _singleClickButton = (LinkButton)e.Row.Cells[0].Controls[0]; // Get the javascript which is assigned to this LinkButton string _jsSingle = ClientScript.GetPostBackClientHyperlink(_singleClickButton, ""); // To prevent the first click from posting back immediately // (therefore giving the user a chance to double click) pause the // postback for 300 milliseconds by using setTimeout _jsSingle = _jsSingle.Insert(11, "setTimeout(\""); _jsSingle += "\", 300)"; // Add this javascript to the onclick Attribute of the row e.Row.Attributes["onclick"] = _jsSingle; } }
//protected void dd_Buyer_SelectedIndexChanged(object sender, EventArgs e) //{ // CommonFunctions commonfunctions = new CommonFunctions(); // String buyerId = "0"; // buyerId = dd_Buyer.SelectedValue; // if (buyerId != "0") // { // string qry = string.Empty; // qry = "Proc_Buyer_Wise_File_Load '" + buyerId + "'"; // commonfunctions.g_b_FillDropDownListByQurey(dd_File, qry); // } // else // { // commonfunctions.g_b_FillDropDownList(dd_File, // "TBL_Export_LC_FileNo_BTB_Percent", // "File_Ref_No", // "File_Ref_Id", string.Empty); // } //} protected void gdv_Fabric_RowDataBound(object sender, GridViewRowEventArgs e) { #region gdv_ChildrenInfo_RowDataBound try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = GlobalVariables.g_s_style_onmouseover; e.Row.Attributes["onmouseout"] = GlobalVariables.g_s_style_onmouseout; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gdv_Fabric, "Select$" + e.Row.RowIndex); } } catch (Exception exception) { lblMsg.Text = exception.Message; } #endregion gdv_ChildrenInfo_RowDataBound }
protected void dtgUsergrid_RowCreated1(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.RowState == DataControlRowState.Alternate) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White';"); } else { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='lightblue';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#EFF3FB';"); } e.Row.Style.Add("cursor", "pointer"); e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.dtgUsergrid, "Select$" + e.Row.RowIndex); } }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { foreach (GridViewRow row in locationGrid.Rows) { if (row.RowType == DataControlRowType.DataRow) { row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';"; row.Attributes["onmouseout"] = "this.style.textDecoration='none';"; // Set the last parameter to True // to register for event validation. row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(locationGrid, "Select$" + row.DataItemIndex, true); } } base.Render(writer); }
protected void gdv_Item_RowDataBound(object sender, GridViewRowEventArgs e) { #region gdv_ChildrenInfo_RowDataBound try { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onmouseover"] = GlobalVariables.g_s_style_onmouseover; e.Row.Attributes["onmouseout"] = GlobalVariables.g_s_style_onmouseout; e.Row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(this.gdv_Item, "Select$" + e.Row.RowIndex); } } catch (Exception exception) { //lbl_msg_StaffRequisitionDetails.ForeColor = GlobalVariables.g_clr_errorColor; lblMsg.Text = exception.Message; } #endregion gdv_ChildrenInfo_RowDataBound }