ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.[Solved] System.IndexOutOfRangeException: There is no row at position 0<p>Hi <a class="username" rel="KatieNgoc">KatieNgoc</a>,</p> <p>Refer below sample.</p> <p>Make sure in your datatable is having record.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">Name : &lt;asp:TextBox runat=&#34;server&#34; ID=&#34;txtName&#34; /&gt; &lt;br /&gt; &lt;asp:Button ID=&#34;Button1&#34; Text=&#34;Login&#34; runat=&#34;server&#34; OnClick=&#34;Logins&#34; /&gt;</pre> <p><strong>Default.aspx</strong></p> <pre class="brush: html">&lt;asp:CheckBox Text=&#34;Remember Me&#34; runat=&#34;server&#34; OnCheckedChanged=&#34;Save&#34; ID=&#34;chckStatus&#34; AutoPostBack=&#34;true&#34; /&gt;&lt;br /&gt; &lt;asp:Button ID=&#34;Button1&#34; Text=&#34;NextPage&#34; runat=&#34;server&#34; OnClick=&#34;NextPage&#34; /&gt;</pre> <p><strong>Logout.aspx</strong></p> <pre class="brush: html">&lt;asp:HyperLink ID=&#34;HyperLink1&#34; NavigateUrl=&#34;~/Login.aspx&#34; runat=&#34;server&#34; Text=&#34;Logout&#34; /&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <pre class="brush: csharp">using System.Configuration; using System.Data.SqlClient; using System.Data;</pre> <p><strong>Login.aspx.cs</strong></p> <pre class="brush: csharp">protected void Logins(object sender, EventArgs e) { Session[&#34;Name&#34;] = txtName.Text; Response.Redirect(&#34;Default.aspx&#34;); }</pre> <p><strong>Defauls.aspx.cs</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings[&#34;constr&#34;].ConnectionString; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(&#34;SELECT Status FROM tblStatusCheck WHERE @Name = @Name&#34;, con); cmd.Parameters.AddWithValue(&#34;@Name&#34;, Session[&#34;Name&#34;].ToString()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count &gt; 0) { chckStatus.Checked = Convert.ToBoolean(dt.Rows[0][&#34;Status&#34;].ToString()!= &#34;true&#34;) ? true : false; } } } protected void Save(object sender, EventArgs e) { bool status = chckStatus.Checked; string constr = ConfigurationManager.ConnectionStrings[&#34;constr&#34;].ConnectionString; SqlConnection con = new SqlConnection(constr); SqlCommand cmd = new SqlCommand(&#34;UPDATE tblStatusCheck SET Status = @Status WHERE Name = @Name&#34;, con); cmd.Parameters.AddWithValue(&#34;@Status&#34;, status); cmd.Parameters.AddWithValue(&#34;@Name&#34;, Session[&#34;Name&#34;].ToString()); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } protected void NextPage(object sender, EventArgs e) { Response.Redirect(&#34;Logout.aspx&#34;); }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/Thu, 22 Aug 2019 03:23:10 GMT[Solved] System.IndexOutOfRangeException: There is no row at position 0<p><strong></strong></p> <h2><em>Compilation Error</em></h2> <p><strong><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><strong>Description:&nbsp;</strong>An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.&nbsp;<br /><br /><strong>Compiler Error Message:&nbsp;</strong>BC30456: 'Save' is not a member of 'default_aspx'.<br /><br /><strong>Source Error:</strong><br /><br /></font></strong></p> <table width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td>&nbsp;</td> </tr> <tr> <td> <pre>Line 2: Line 3: &lt;asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"&gt; <font color="red">Line 4: &lt;asp:CheckBox Text="Remember Me" runat="server" OnCheckedChanged="Save" ID="chckStatus" </font>Line 5: AutoPostBack="true" /&gt;&lt;br /&gt; Line 6: &lt;asp:Button ID="Button1" Text="NextPage" runat="server" OnClick="NextPage" /&gt;</pre> </td> </tr> </tbody> </table> <p><strong><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><br /><strong>Source File:</strong>&nbsp;C:\Users\Katie Le\source\repos\RememberAgreeCheckBox\RememberAgreeCheckBox\Default.aspx &nbsp;&nbsp;&nbsp;<strong>Line:</strong>&nbsp;4&nbsp;</font></strong></p> <p>&nbsp;</p> <p>I got the error as the above</p>https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/Thu, 22 Aug 2019 10:38:04 GMT[Solved] System.IndexOutOfRangeException: There is no row at position 0<p>Hi <a class="username" rel="KatieNgoc"> KatieNgoc</a>,</p> <p>Refer below links -</p> <p><a href="https://stackoverflow.com/questions/21517188/ratingcontrolchanged-is-not-a-member-of-asp-default-aspx">https://stackoverflow.com/questions/21517188/ratingcontrolchanged-is-not-a-member-of-asp-default-aspx</a></p> <p><a href="https://www.codeproject.com/Questions/697771/BC30456-btnLogin-Click-is-not-a-member-of-ASP-defa">https://www.codeproject.com/Questions/697771/BC30456-btnLogin-Click-is-not-a-member-of-ASP-defa</a></p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/https://www.aspforums.net:443/Threads/132351/Solved-SystemIndexOutOfRangeException-There-is-no-row-at-position-0/Fri, 23 Aug 2019 04:45:07 GMT