PDA

View Full Version : مشکل با CHECKBOXLIST



amirjooni2004
سه شنبه 13 شهریور 1386, 12:26 عصر
کمکم کنید . جواب نمیده
اگه راه حل بهتری هم هست بگین


Dim q As String
Dim i As Integer = 0
Dim c As Integer = 0
For i = 0 To CheckBoxList1.Items.Count()
If CheckBoxList1.Items(i).Selected Then '***** problem is here
If c = 0 Then
q = CheckBoxList1.SelectedItem.Value
c = 1
Else
q += "," + CheckBoxList1.SelectedItem.Value
End If
End If
Next
Response.Redirect("et_report_complete_result.aspx?name=" + q + "&id=" + CStr(CheckBox1.Checked) + "&location=" + CStr(CheckBox2.Checked) + "&raste=" + CStr(CheckBox3.Checked) + "&boss=" + CStr(CheckBox4.Checked) + "&session=" + CStr(CheckBox5.Checked) + "&employee=" + CStr(CheckBox6.Checked) + "&group=" + CStr(CheckBox7.Checked) + "&amval=" + CStr(CheckBox8.Checked) + "&bank=" + CStr(CheckBox9.Checked) + "&bodje=" + CStr(CheckBox10.Checked))

shahab_ksh
سه شنبه 13 شهریور 1386, 12:45 عصر
If CheckBoxList1.Items(i).Selected Then '***** problem is here


ببینید مشکل اینطوری حل شد



If CheckBoxList1.Items(i).Selected = True Then

amirjooni2004
سه شنبه 13 شهریور 1386, 13:22 عصر
امتحان کردم و نشد که نشد
صد تا راه دیگه هم امتحان کردم ، بازم نشد

amirjooni2004
سه شنبه 13 شهریور 1386, 13:24 عصر
این خطا رو میده


Index was out of range. Must be non-negative and less than the size of the collection.<br>Parameter name: index body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index