Blank Combobox after postback

4 posts, 1 answers
  1. Kris
    Kris avatar
    17 posts
    Member since:
    Dec 2006

    Posted 12 Jun 2011 Link to this post

    Hello,

    I want to achieve that when a user makes a selection with the combobox (cboVolgnr) 016 in my example (see pic), the results comes up and the user wants to clean up his selection but the selection is still there. I thought that the code was complete but it still doesn't works... My code:

     

    <td style="width:50px">Volgnr</td>

    <td style="width:75px"><telerik:RadComboBox ID="cboVolgnr" Runat="server" Width="75px" Filter="StartsWith"><HeaderTemplate>
    <ul><li class="colvolg1">Volgnr</li><li class="colvolg2">Code</li><li class="colvolg3">EI</li><li class="colvolg4">Omschr</li></ul></HeaderTemplate>

     

    <ItemTemplate>

     

    <ul>

     

    <li class="colvolg1"><%#Eval("Volgnr")%></li >

     

    <li class="colvolg2"><%#Eval("Code")%></li >

     

    <li class="colvolg3"><%#Eval("EI")%></li>

     

    <li class="colvolg4"><%#Eval("Omschr")%></li >

     

    </ul >

     

    </ItemTemplate>

     

    </telerik:RadComboBox>

     

    </td >

    cboVolgnr.Text = ""

     

     

     

     

     

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me

     

    .Load

     

     

     

     

     

        Dim cn As New SqlConnection(cnnBN.ToString), cmd As SqlCommand, dr As

     

    SqlDataReader

     

     

     

     

     

        Dim strSQL As String = "SELECT * FROM tblBWPeriodes WHERE DJ = "

     

    & strDJ

     

     

     

     

     

        Try

     

     

     

     

            cn.Open()

     

     

     

     

            cmd = New SqlCommand(strSQL, cn)

     

     

     

     

            dr = cmd.ExecuteReader

     

     

            combo.DataTextField = 

     

    "volgnr"

     

     

     

     

            combo.DataValueField = "volgnr"

     

     

     

     

            combo.DataSource = dr

     

     

     

     

            combo.DataBind()

     

     

            combo.Skin = 

     

    "Office2007"

     

     

     

     

        Catch ex As Exception

     

     

     

     

            Throw ex

     

     

     

     

        End

     

    Try

     

     

     

        dr = Nothing

     

     

     

     

        cmd = Nothing

     

     

     

     

        cn.Dispose()

     

     

     

     

        cn = Nothing

     

     

     

     

        cboVolgnr.HighlightTemplatedItems = True

     

     

     

     

        cboVolgnr.AllowCustomText = True

     

     

     

     

        cboVolgnr.EmptyMessage = "Alles"

     

     

     

     

        cboVolgnr.DropDownWidth = 500

     

     

         cboVolgnr.Height = 375

     

     

     

    End

     

    Sub

     

    Protected Sub btnCriteria_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles

     

    btnCriteria.Click

     

     

     

    ...

     

     

     

     

        cboVolgnr.Text = ""

     

     

     

     

    End

     

    Sub

    Is there something I am missing?  Can you give me a help?

    Kind regards,
    Kris

     

     

     

     

     

     

     

     

     

     

     

  2. Kris
    Kris avatar
    17 posts
    Member since:
    Dec 2006

    Posted 14 Jun 2011 Link to this post

    No one has the answer?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 16 Jun 2011 Link to this post

    Hello Kris,

    In general when RadComboBox control is "read-only" - there is always a selected item in it.
    You can overcome the issue by setting the AllowCustomText property of the RadComboBox to "true".
    I created a small example for you - please find it attached.

    All the best,
    Kalina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Kris
    Kris avatar
    17 posts
    Member since:
    Dec 2006

    Posted 16 Jun 2011 Link to this post

    Hello Kalina,

    Thank you for the answer.  I did the set=true of AllowCustomText but I saw in your code that you also used the clearselection() which I did not.  That did it!  Now it works.  That you very much;

    Kind regards,
    Kris
Back to Top