Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Specified argument was out of the range of valid values. Parameter

Reply
Thread Tools

Specified argument was out of the range of valid values. Parameter

 
 
Dave
Guest
Posts: n/a
 
      09-24-2010
I have a GridView that I'm trying to implement a Confirm OnDelete.
The below code works except that I'm getting the error "Specified
argument was out of the range of valid values. Parameter name: index"
when ever I click Update. I know that this is happening because there
are no controls now in that cell. What condition can I test against?

Thanks


/////////////////CODE/////////////////////

<asp:GridView ID="SOCCatGridView" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="ssoccID"
DataSourceID="CATGridSqlDataSource"
OnRowDataBound="SOCCatGridView_RowDataBound"
OnRowDeleted="SOCCatGridView_RowDeleted"
OnSelectedIndexChanged="SOCCatGridView_SelectedInd exChanged"
BackColor="White" AutoGenerateDeleteButton="True">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ssoccID" HeaderText="ssoccID"
InsertVisible="False" ReadOnly="True"
SortExpression="ssoccID" Visible="False" />
<asp:BoundField DataField="DisplayOrder" HeaderText="Order"
SortExpression="DisplayOrder" />
<asp:BoundField DataField="SOCCategory" HeaderText="SOC
Category" SortExpression="SOCCategory" />
</Columns>
<EmptyDataTemplate>
There are no Categories defined.
</EmptyDataTemplate>
</asp:GridView>


/////////////// C# Code //////////////
protected void DetailGridView_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

LinkButton db = (LinkButton)e.Row.Cells[0].Controls[1];
db.OnClientClick = string.Format("return confirm('Are you
certain you want to delete this record?');");

}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Specified argument was out of the range of valid values.Parameter name Index. siha General Computer Support 0 12-07-2010 01:51 AM
Specified argument was out of the range of valid values.Parameter Chapi ASP .Net 2 05-26-2008 05:38 PM
Specified argument was out of the range of valid values. Parameter name: value? darrel ASP .Net 0 08-14-2006 10:32 PM
error: Specified argument was out of the range of valid values. Parameter name: index Dave ASP .Net Datagrid Control 11 07-09-2006 01:19 PM
Specified argument was out of the range of valid values. Parameter name: 0 Todd Perkins ASP .Net 0 09-15-2004 07:46 PM



Advertisments