本文介绍了如何在C#中使用Page.ClientScript.GetPostBackClientHyperlink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Hi Geeks, 我有一个选定列和行的网格视图。该行包含一行中每列的文本框。我需要选择一行以获取当前使用以下代码完成的rowindex。 Hi Geeks,I've a gridview with selected columns and rows. The row consists of Textbox for every column in a row. I need to select a row in order to get the current rowindex which I've done using below code.protected void gvtotqty_onrowdatabound(object sender, GridViewRowEventArgs e){ if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes["onclick"] = Page.ClientScript.GetPostBackClientHyperlink(gvtotqty, "Select$" + e.Row.RowIndex); e.Row.ToolTip = "Click to select this row."; }}protected void gvtotqty_onselectedindexchanged(object sender, EventArgs e){ foreach (GridViewRow row in gvtotqty.Rows) { if (row.RowIndex == gvtotqty.SelectedIndex) { Session["rowindex"]=row.RowIndex; row.BackColor = ColorTranslator.FromHtml("#A1DCF2"); row.ToolTip = string.Empty; } else { row.BackColor = ColorTranslator.FromHtml("#FFFFFF"); row.ToolTip = "Click to select this row."; } }} 一切正常,我在调试时得到了rowindex但是我无法在Textbox中输入任何内容,因为它正在刷新。我知道 Everything is working fine where I get my rowindex when debugged but I am not able to type anything in Textbox as it is getting refreshed. I know thatPage.ClientScript.GetPostBackClientHyperlink 调用PostBackEvent。通过使用此方法,如何在文本框中键入值?calls PostBackEvent. By using this method, how can I type the values in Textboxes?推荐答案 一切正常,我在调试时得到了rowindex但是我无法在Textbox中输入任何内容,因为它正在刷新。我知道 Everything is working fine where I get my rowindex when debugged but I am not able to type anything in Textbox as it is getting refreshed. I know thatPage.ClientScript.GetPostBackClientHyperlink 调用PostBackEvent。通过使用此方法,如何在文本框中键入值?calls PostBackEvent. By using this method, how can I type the values in Textboxes? 这篇关于如何在C#中使用Page.ClientScript.GetPostBackClientHyperlink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-28 01:35