चेकबॉक्स से डेटा पुनः प्राप्त करने का प्रयास करते समय समस्या

वोट
1

मैं एक चेकबॉक्स में चुनिंदा आइटम सूची नीचे कोड निष्पादित करने के लिए कोशिश कर रहा हूँ

मेल के शरीर के लिए

 Dim CheckedValues As String
                For Each item In txt_panview0_ddinput1.Items
                    If item.checked Then
                        checkedValues = checkedValues & item.selectedValue

                    End If
                Next
                If Not String.IsNullOrEmpty(checkedValues) Then
                    checkedValues = checkedValues.Substring(1)
                End If


                tempCollector = tempCollector + <br> + Area Name + :  + checkedValues

लेकिन मैं निम्नलिखित त्रुटि हो रही है ..

System.MissingMemberException: Public member 'checked' on type 'ListItem' not found. 
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, 
Boolean ReportErrors) at Microsoft.VisualBasic.CompilerServices.NewLateBinding.
LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] 
TypeArguments, Boolean[] CopyBack) at WebApplication1._Default.collectEmailBodyText() 
in C:\UseFormCode\UseFormEnhWorking\Default.aspx.vb:line 271 

कृपया सहायता कीजिए

30/07/2009 को 15:13
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


1 जवाब

वोट
1

एक करने के लिए यात्रा में प्रत्येक आइटम टाइपकास्ट CheckBoxअगर यह जाँच की है की जाँच से पहले:

For Each item In txt_panview0_ddinput1.Items
     dim c as CheckBox = Ctype(item.Value, CheckBox)
     If c.checked Then
         checkedValues = checkedValues & item.selectedValue
    End If
Next

एक से अधिक मान का चयन सक्षम करने के लिए, सेट SelectionModeकी संपत्ति ListBoxके लिए Multiple:

<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple"></asp:ListBox>

फिर चयनित मूल्यों पर पुनरावृति करने के लिए निम्नलिखित का उपयोग करें:

For Each item as ListItem In txt_panview0_ddinput1.Items
         If item.Selected Then
             CheckedValues = CheckedValues & item.Value
        End If
Next

पुनश्च मैं VB.Net वाक्य रचना पर जंग लगी थोड़ा तो मेरे कोड वाक्य रचना सही नहीं हो सकता है

30/07/2009 को 15:17
का स्रोत उपयोगकर्ता

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more