问题
I am Using ASP.net C#, I am using GridView, and I am unable to select row, when i press select command on gridview. In actual when i select a row, the request is sent to another page, on which the selected record is showed in detailsview. it was working fine before, but when i tried to format my gridview with css, This msg shows up in browser's footer and nothing happens.
`javascript:__doPostBack('Gridview1','Select$4') //4 is the row no.`
other than this, theres no exception or error. Here is my code. The aspx code is:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
onselectedindexchanged="my_onSelectedIndexChanged" >
<Columns>
<asp:BoundField DataField="jposted_date" HeaderText="jposted_date"
SortExpression="jposted_date" />
<asp:BoundField DataField="job_title" HeaderText="job_title"
SortExpression="job_title" />
<asp:BoundField DataField="status" HeaderText="status"
SortExpression="status" />
<asp:CommandField ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [jposted_date], [job_title], [status] FROM [job_post]">
</asp:SqlDataSource>
and the code behind .cs is:
protected void my_onSelectedIndexChanged(object sender, EventArgs e)
{
string RecordId = GridView1.SelectedRow.Cells[0].Text;
Session["RecordID"] = RecordId;
Response.Redirect("try.aspx");
}
i have removed the css on my gridview, but still getting this javascript msg and i am a loss what else to do? can anyone suggest what i am doing wrong? or what am i missing here? Help would be highly appreciated. thanx in advance.
P.S. also Nothing happens when i click on pagging to view next records.same msg is shown in browsers footer.
来源:https://stackoverflow.com/questions/17025043/asp-net-c-unable-to-select-in-gridview-when-i-press-the-select-button-nothing