Dataform insert bind RadDropDownList

4 posts, 0 answers
  1. Mark
    Mark avatar
    12 posts
    Member since:
    Jul 2015

    Posted 21 Jun Link to this post

    Hi

    My DataForm displays data in edit mode just fine, with a selection of textboxs and RadDropDownList's.

    The RadDropDownList bind via the RadDataForm1_ItemDataBound event.

     

    But when I am in insert mode how do I populate/bind  my  RadDropDownList in code behind?

    The ItemDataBound doesn't fire

     

    Many Thanks

     

    Mark

     

  2. Mark
    Mark avatar
    12 posts
    Member since:
    Jul 2015

    Posted 21 Jun in reply to Mark Link to this post

    This seems to work using ItemCreated event.

    But is this the correct way to bind?

     

    Thanks

    MArk

     Private Sub RadDataForm1_ItemCreated(sender As Object, e As RadDataFormItemEventArgs) Handles RadDataForm1.ItemCreated
            If TypeOf e.Item Is IRadDataFormInsertItem Then
                Dim item As RadDataFormEditableItem = TryCast(e.Item, RadDataFormEditableItem)
                'Dim textBox As TextBox = TryCast(item.FindControl("CompanyNameTextBox"), TextBox)
           end if



                Dim RadDropDownListlicense As RadDropDownList = DirectCast(item.FindControl("RadDropDownListlicense"), RadDropDownList)
                RadDropDownListlicense.DataSource = objWedData.GetDataTable("SELECT l_ir,l_name FROM license")
                RadDropDownListlicense.DataTextField = "l_name"
                RadDropDownListlicense.DataValueField = "l_ir"
                RadDropDownListlicense.DataBind()

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark
    Mark avatar
    12 posts
    Member since:
    Jul 2015

    Posted 22 Jun in reply to Mark Link to this post

    Hi again.

    Would there be an example of a the Dataform being used in quite a detailed way? Most if not all the examples are quite basic.

    I went down the route of data binding without using datasource objects and binding with code behind. 

    What i'm finding with this control and others, is that i'm using work rounds and jarvascript more and more as the site grows.

    What worries me is that my approach may be wrong. It would be good to see an example that uses telerik asp controls in a more real life way.

    No worries if not.

     

    Thanks

     

    Mark

  5. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 24 Jun Link to this post

    Hi Mark,

    You can use the DataBinding event handler of the combo to achieve this requirement. You can check the sample provided in the following article for a sample web site with RadDataForm:
    http://www.telerik.com/support/code-library/accessing-controls-in-dataform

    I am also sending another web site to demonstrate a more advanced scenario.

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik
Back to Top