Specified argument was out of range of valid values. Parameter name:Value

Hi Guru's,

 Below is my problem.

I have a user control, in which I have a ajax tab control. At design time I just have the tabcontainer and depending on the id passed to the control I am generating the contents for the tab's. Basically each of the tab contains a list of items for each item a series of option buttons are presented to mark the score. 

I have set eanable view state to false for tab and all the dynamically generated radio buttons and checkbox's, and enabled autopostback to ture, when I click on any of radio button, checkbox or image button I get Specified argument was out of range of valid values. Parameter name: value, I am stuck with no clues to crack the issue.

When I dynamically create a radio button with same properties on a web form (aspx) post back happens with out any problem, but why not inside of an user control?

well my tab control is in a updatepanel which will get loaded into a content place holder. Any ideas why this error is occuring and suggestion will be of great help.

Below is the procedure from user control that creates the tab's and its contents dynamically, I read in many posts that the dynamic controls needs to be created in page_init event, but in order to create the controls I would require to read the usercontrol's property valuyes (in my case _assessmentID) which is not available, so other question are user control's properties available in page_init event of the user control?

Private Sub GenerateCompetencyTabs(ByVal aScore As AssessmentScore, ByVal assessmentID As Int32)

Dim competency As AssessmentScore.CompetencyDataTable = aScore.Competency

Dim cbs As AssessmentScore.AssessmentDataTable = aScore.Assessment

Dim bComment As AssessmentScore.BehaviourCommentsDataTable = aScore.BehaviourComments

Dim scoreType As AssessmentScore.ScoreTypeDataTable = aScore.ScoreType

For count As Int16 = 0 To competency.Rows.Count - 1

'For each competency

Dim tbl As Table = New Table()

'Generate header for the competency tab

tbl.Rows.Add(GenerateHeader(scoreType))

Dim pnl As AjaxControlToolkit.TabPanel = New AjaxControlToolkit.TabPanel()

pnl.ID = competency.Rows(count)("ID")

pnl.HeaderText = competency.Rows(count)("Name")

Dim filterExpr As String = "Competency_ID=" & competency.Rows(count)("ID")

Dim cbsFiltered() As DataRow

cbsFiltered = cbs.Select(filterExpr)

'iterate thru all assessment records

For i As Int16 = 0 To cbsFiltered.Length - 1

'3 areas to fill in each assessment record

'0 -> plan of action

'1 -> Behaviour

'2 -> Scores

'3 -> comment button

Dim tblRow As TableRow = New TableRow()

For j As Int16 = 0 To 4

Select Case j

Case 0

If (cbsFiltered(i)("Assessment_Status") = 1) Then

Dim chk As CheckBox = New CheckBox

chk.ID = "chk" & cbsFiltered(i)("Competency_ID") & "|" & cbsFiltered(i)("Behaviour_ID")

chk.EnableViewState = False

chk.AutoPostBack = True

Dim plCell As TableCell = New TableCell()

plCell.Controls.Add(chk)

plCell.VerticalAlign = VerticalAlign.Top

tblRow.Cells.Add(plCell)

End If

Case 1

If (cbs.Rows(i)("Assessment_Status") = 1) Then

Dim bnCell As TableCell = New TableCell()

Dim img As Image = New Image()

img.ID = "img_inf" & cbsFiltered(i)("Behaviour_ID")

img.ImageUrl = "~/images/info.gif"

img.ToolTip = cbsFiltered(i)("Behaviour_Description")

bnCell.Controls.Add(img)

bnCell.Controls.Add(
New LiteralControl("&nbsp"))

Dim bName As Label = New Label()

bName.ID = cbsFiltered(i)("Behaviour_ID")bName.Text = cbsFiltered(i)("Behaviour_Long_Title")

bnCell.Controls.Add(bName)

bnCell.Controls.Add(New LiteralControl("&nbsp"))

Dim cImg As Image = New Image()

cImg.ID = "img_comment" & cbsFiltered(i)("Behaviour_Id")

cImg.ImageUrl = "~/Images/minus.gif"

Dim cImg_Client As String = Me.UniqueID & "$tabScore$" & cbsFiltered(i)("Competency_Id") & "$" & cImg.UniqueID

cImg_Client = cImg_Client.Replace("$", "_")

If (cbsFiltered(i)("Assessment_Status") = 1) Then

Dim behaviourComments() As DataRowDim commentsExpr As String = "Behaviour_ID=" & cbsFiltered(i)("Behaviour_ID") & " AND Assessor_ID=" & cbsFiltered(i)("Assessor_ID") & " AND Assessment_ID= " & cbsFiltered(i)("Assessment_ID")

behaviourComments = bComment.Select(commentsExpr)

'create a literal control for each comment and add it to dv

Dim dv As HtmlGenericControl = New HtmlGenericControl("Div")

If (behaviourComments.Length() >= 1) Then

dv.ID = "dv_Comment" & cbsFiltered(i)("Behaviour_Id")

Dim sCtrlName As String = Me.UniqueID & "$tabScore$" & cbsFiltered(i)("Competency_Id") & "$" & dv.UniqueID

sCtrlName = sCtrlName.Replace("$", "_")

cImg.Attributes.Add("onClick", "Collapse('" & sCtrlName & "','" & cImg_Client & "')")

'dv.Controls.Add(cImg)

bnCell.Controls.Add(cImg)

End If

For c As Int16 = 0 To behaviourComments.Length() - 1

If (cbsFiltered(i)("assessment_Status") = 1) Then

Dim lc As LiteralControl = New LiteralControl()

lc.Text = " " & behaviourComments(c)("Comments") & "<br/>" & behaviourComments(c)("Assessor_Full_Name") _

& " on " & Common.ConvertToDate(behaviourComments(c)("Created_Date"), Session("Culture")) _

& "<BR/>"

dv.Controls.Add(lc)

End If

Next c

bnCell.Controls.Add(dv)

End If

tblRow.Cells.Add(bnCell)

End If

Case 2

'paint option buttons for scores

For k As Int16 = 0 To scoreType.Rows.Count - 1

Dim opt As RadioButton = New RadioButton()

opt.ID = "opt" & cbsFiltered(i)("Competency_ID") & "|" & cbsFiltered(i)("Behaviour_ID") & "|" & scoreType.Rows(k)("ID")

opt.GroupName = cbsFiltered(i)("Behaviour_ID")

opt.AutoPostBack = True

opt.EnableViewState = False

'AddHandler opt.CheckedChanged, AddressOf opt_CheckChanged

Dim scCell As TableCell = New TableCell()

If (cbsFiltered(i)("Assessment_Status") = 1 And scoreType.Rows(k)("ID") = cbsFiltered(i)("ScoreID")) Then

opt.Checked = True

End If

If (cbsFiltered(i)("Assessment_Status") = 1) Then

scCell.Controls.Add(opt)

scCell.VerticalAlign = VerticalAlign.Top

tblRow.Cells.Add(scCell)

End If

Next

Case 3

'paint button / image for behaviour comments

If (cbsFiltered(i)("Assessment_Status") = 1) Then

Dim btnComment As ImageButton = New ImageButton()

btnComment.ID = "bComment" & cbsFiltered(i)("Behaviour_ID")

btnComment.ImageUrl = "~/images/Add_Comment.jpg"

AddHandler btnComment.Click, AddressOf btnComment_Click

'btnComment.PostBackUrl = "~/authorise/addbehaviourcomment.aspx"

Dim btnCell As TableCell = New TableCell()

btnCell.Controls.Add(btnComment)

tblRow.Cells.Add(btnCell)

End If

End Select

Next

tbl.Rows.Add(tblRow)

Next

'same comments repeated on every tab page

Dim commentRow As TableRow = New TableRow()Dim commentCell As TableCell = New TableCell()

commentCell.ColumnSpan = scoreType.Rows.Count + 3

Dim lbl As Label = New Label()

lbl.Text = GetLocalResourceObject("lblComment")

commentCell.Controls.Add(lbl)

commentRow.Cells.Add(commentCell)

tbl.Rows.Add(commentRow)

pnl.Controls.Add(tbl)

tabScore.Tabs.Add(pnl)

Next

tabScore.ActiveTabIndex = 0

End Sub

0
bcsanthosh
10/14/2008 10:44:12 AM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

1 Replies
661 Views

Similar Articles

[PageSpeed] 5

Hi Folks,

Managed to solve it myself, On the aspx page I created the usercontrol at run time in init event of the page, whcih enabled me to set the property before the init event of the usercontrol. Then in user control I moved the code to generate the dynamic controls from page load to page init and viola every thing is working like a charm.

Thanks for taking out time to look at my post.

Regards,
Santhosh

0
bcsanthosh
10/15/2008 9:24:43 AM
Reply:

Similar Artilces:

specified argument was out of the range of valid values parameter name: value
 hello everyone, i need your help.. i have a gridview that has a delete button, this gridview is inside a parent gridview. my problem now is when i delete the row(the child griview will always contain one row only)  it gave me an error stating that the specified argument was out of range of valid values parameter name: value, after refreshing that's the only time the delete button will function correctly. what could be the possible reason for this, this error appears occasionally, i can't afford to have this error during our defense..please help....here is my code for delet...

Specified argument was out of the range of valid values. Parameter name: value
I am having a very difficult issue to resolve with this one. I have a GridView where I have set AutoGenerateDeleteButton to true, and I have a delete query in my DataSource. The delete query is actually a Stored Procedure. Within that stored procedure I initially just deleted the row and also deleted some related records, and also updated a related record with a timestamp. That all worked just fine. However, I then added a Cursor to the Stored Procedure that goes through all of the records in a given set and renumbers them after the delete. After adding this Cursor to the Stored Proce...

Specified argument was out of the range of valid values. Parameter name: value
I have two drop down list, one are titles, second one are title definition. after clicking titles dropdown list, second one will show the definition. it works fine when I used code below in the function BindData_Type_dropdown() type_DropDownList.DataSource = ds.Tables(0)         'type_DropDownList.DataTextField = ds.Tables(0).Columns("Title").ColumnName.ToString()         'type_DropDownList.DataValueField = ds.Tables(0).Columns("ID").ColumnName.ToString()         'type_DropDownList.Data...

(Urgent) specified argument was out of the range of valid values. Parameter name: Value
Hi  i have a datagrid in a user control which has pagin and sorting enabled and the data loads fine.. I am calling this UserControl in a tab panel using Ajax.. But when I Try to sort and page in my tab Panel...i get an error saying  specified argument was out of the range of valid values. Parameter name: Value Hope u can help me solve it.. I am dynamically generating the Tabpanel and passing the valid values to load the user control.. but when i try to page and sort i get a popup with the above error.. Any help will be appreicated. Regards Karen Golden rule about ...

Error:
Can anyone help me, I am getting the following error whilst attempting to retrieve data from an Access DB: Specified argument was out of the range of valid values. Parameter name: value I receive this error from a method which uses a select statement to retrieve data into a datareader, and then I place the value of each of the columns into variables. I have another method before this one which is identical, except for the select statement, and it gives me no errors at all. Here is my code: 'create the connection string objects Dim connstr As String co...

critical error has occurred.Specified argument was out of the range of valid values. Parameter name: value
In Debug mode my cutome module is working well. After that i created a zip file to upload the module and also i deleted my tables and store procedures.When I upload my zip file there is no error, Table and All the storeprocedures are installed  in my database.I don't know what is the problem.The error message is this The problem could be that you did not set valid default values for you module settings.Have a look at this.Best regardsHans-PeterDNNPortal German DotNetNuke Community Thank you very muchI reolve that problem by setting the default settings.Now i have one more probl...

(urgent) How do i handle this error in tabs: ( specified argument was out of the range of valid values. Parameter name: Value)
Hi   My user control consisted of a datagrid and in that datagrid i was diplaying the plans for that particular user.. My user control consits of paging and sorting but when i click on those pages no and sort by column name i get and error in the form of an popup window but the pagin and the sorting is been handled by the User control...  specified argument was out of the range of valid values. Parameter name: Value   What should i do to solve it Regards KAren...

Specified argument was out of the range of valid values. Parameter name: Hour, Minute, and Second parameters describe an unrepresentable DateTime.
This error frequently occurs when run OleDbCommand.ExecuteReader to query data from Oracle database and then bind to the DataGrid. In sql select statement has no any datatype date column. I use Oracle Provider for OLE DB. Check out my post on storing dates in Oracle at http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=341221...

Error adding node
 I have a recordset that I loop thru adding nodes to my treeview.Well at around record # 123 out of 500 or so, I get this error adding child node :"Specified argument was out of the range of valid values.Parameter name: Index was out of range.  Must be non-negative and less than the size of the collection." The node I'm adding to exists, and I can't see anything wrong w/ the data -  and it always gets hung up on the same record.*And the same code has been used 122 times already w/out issue. *Any ideas ?  my code: 'lastDivisionIndex = 1'...

Specified argument was out of the range of valid values. Parameter name: index
This is the error I'm getting. I will paste my code below: " DeleteCommand="DELETE FROM [Friends] WHERE [FriendName] = @FriendName" SelectCommand="SELECT * FROM [Friends] WHERE (([FriendName] = @FriendName))" UpdateCommand="UPDATE [Friends] SET [UserName] = @UserName, [UserID] = @UserID, [IP] = @IP, [AddedOn] = @AddedOn, [FriendName] = @FriendName, [IsApproved] = @IsApproved WHERE [FriendID] = @FriendID"> ...

Specified argument was out of the range of valid values Parameter name: index
i'm having a weird problem that isn't reproducing itself on any of my other pages. i need to run an if/else in page_load, the if statement is the text value of a label in a datalist (if the label is null do this, if it's not do that) - my datalist and sqldatasource code looks like this:  <asp:DataList ID="DataList1" runat="server" DataSourceID="iplist"> <ItemTemplate> ip: <asp:Label ID="ipLabel" runat="server" Text='<%# Eval("ip&...

Specified argument was out of the range of valid values. Parameter name: index
I am getting an error on this statement within the code(below): Line 109: Dim UserID as TextBox = e.Item.Cells(1).Controls(0). I don't know if it has anything to do with that I am not updating the UserID at all. But I am not recieving the UserID anywhere except when the data is binded in the datagrid. The UserID is read only so it cannot be changed. I am just changing little things like the name, emailaddress. Any suggestions?? I am just trying to run a simple call to a datagrid where I can Edit, Update and Cancel the information in the grib. Thanks Sub Page_Load(sen...

Specified argument was out of the range of valid values. Parameter name: index
hi i wrote the following code: System.Web.UI.WebControls.Image z=new System.Web.UI.WebControls.Image(); z.Width=100; Table1.Rows[0].Cells[0].Controls.Add(c);and i get this error Specified argument was out of the range of valid values. Parameter name: index i guess its becuse the table size is not initialized, if so i cant find away to do it....does someone have an idea whats the problem?? thanks So the Table doesn't have any rows or cells added yet? If thatr's the case, you'd either put them declaratively there before indexing to the collections (in aspx) or add them dynamically&...

Specified argument was out of the range of valid values. Parameter name: options
when i  try running a  webform i got this error:Specified argument was out of the range of valid values. Parameter name: optionsi dont where the error originated since i didnt put any control on the page i just run a plain webform.. but during the page load the error occured..any help with thi??...thnks in advance guy i keep on  posting this thread but  no reply even one. Need to see the code....Zath i didnt wrote any code just a plain webform no control or whatever the stack trace error is this:  Server Error in '/first' Application. Specified argument wa...

Web resources about - Specified argument was out of range of valid values. Parameter name:Value - asp.net.ajax_control_toolkit

Resources last updated: 11/22/2015 4:27:03 PM