Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6813261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:32:57+00:00 2026-05-26T20:32:57+00:00

I have a modal popup that allows an admin to choose from a variety

  • 0

I have a modal popup that allows an admin to choose from a variety of checkboxes to add features to a specific product. If there is a checkbox that an admin believes should be available but isn’t because that feature is not in the database, I have added a textbox so that user can add a new feature to the product.

Once I added the textbox, it stopped allowing inserts. At first it was in the same If Else as the checkbox for each loop, but I have recently changed it so the textbox is in it’s own for each loop. I have an underline under the words txtFeature.Text that says Value of type 'Char' cannot be converted to 'System.Web.UI.WebControl.Textbox.'

vb code:

  For Each feature As ListItem In cbxAddFeature.Items
        If feature.Selected Then

            Dim strSQL As String = "INSERT INTO Marketing 
                                   (ProductID, MarketingTypeID, MarketingTitle,
                                    MarketingData) 
                                    VALUES (@ProductID, 3, 'Feature', @MarketingData);
                                    UPDATE Product SET ModifyDate = getdate(), 
                                    ModifyUser = @ModifyUser 
                                    WHERE ProductID = @ProductID"

            Using cn As New SqlConnection
            (System.Configuration.ConfigurationManager.ConnectionStrings
            ("LocalSqlServer").ConnectionString)

                Using cmd As New SqlCommand(strSQL, cn)

                    cmd.Parameters.Add(New SqlParameter("@ProductID", ProductID.Value))
                    cmd.Parameters.Add(New SqlParameter("@MarketingData", 
                    feature.Value))
                    cmd.Parameters.Add(New SqlParameter("@ModifyUser", 
                    System.Web.HttpContext.Current.User.Identity.Name))

                    cn.Open()

                    cmd.ExecuteNonQuery()
                End Using

                cn.Close()
            End Using
        Else
        End If
    Next
    For Each txtFeature As TextBox In txtFeature.Text
        If txtFeature.Text Then
            Dim featureSql As String = "INSERT INTO Marketing(ProductID, 
                                        MarketingTypeID, MarketingTitle, MarketingData) 
                                        VALUES (@ProductID, 3, 'Feature', 
                                        @MarketingData);
                                        UPDATE Product SET ModifyDate = getdate(), 
                                        ModifyUser = @ModifyUser 
                                        WHERE ProductID = @ProductID; 
                                        INSERT INTO Feature (FeatureTitle) 
                                        VALUES (@FeatureTitle)"

            Using cn As New SqlConnection
            (System.Configuration.ConfigurationManager.ConnectionStrings
            ("LocalSqlServer").ConnectionString)

                Using cmd As New SqlCommand(featureSql, cn)

                    cmd.Parameters.Add(New SqlParameter("@FeatureTitle", 
                                       txtFeature.Text))

                    cn.Open()

                    cmd.ExecuteNonQuery()
                End Using

                cn.Close()
            End Using
        End If

aspx:

<div class="PopupHeader">Add a Feature</div>
            <asp:CheckBoxList ID="cbxAddFeature" runat="server" 
             DataSourceID="dsNewFeatures" DataTextField="FeatureTitle" 
             DataValueField="FeatureID"></asp:CheckBoxList>
            New Feature:<asp:TextBox ID="txtFeature" runat="server"></asp:TextBox>
            <asp:Label ID="FeatureError" runat="server" ></asp:Label><br />
             <asp:Button ID="SubmitFeatures" runat="server" Text="Submit" />
             <asp:Button ID="CancelSubmitFeatures" runat="server" Text="Cancel" />
        </asp:Panel>
        <asp:ModalPopupExtender ID="FeatureModal" runat="server" 
         BackgroundCssClass="modalBackground" CancelControlID="CancelSubmitFeatures" 
         DropShadow="True" DynamicServicePath="" Enabled="True" 
         PopupControlID="FeaturePanel" TargetControlID="FeatureButton"> 
        </asp:ModalPopupExtender>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:32:58+00:00Added an answer on May 26, 2026 at 8:32 pm

    You are attempting to iterate over a string and cast each character in it to TextBox class: For Each txtFeature As TextBox In txtFeature.Text. Obviously you got an error. Just remove that cycle and check txtFeature.Text property instead: If Not String.IsNullOrEmpty(txtFeature.Text) Then ...

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program where i use a modal popup that allows the user
I have a modal popup with several links inside that have the :confirm and
I have a gridview that is only shown in a modal popup. right before
I'm using ajax requests to populate modal popup windows with data that users have
I have a JInternalFrame window that needs to popup a modal dialog box when
I have a jqgrid in a modal popup that has data dependent on some
I have a modal popup extender tied to a asp:panel control that I want
I have a asp Panel that opens as a Modal Popup window using ajax.
I have a jquery-ui modal popup that contains an iframe. It is called as
I have a modal popup that initially shows some content but expands a div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.