Not able to Find a control in the itemtemplate of the listbox

4 posts, 0 answers
  1. Civbaron
    Civbaron avatar
    20 posts
    Member since:
    Jan 2010

    Posted 18 Jun 2010 Link to this post

    Hi,

    I am trying to set a controls value, based on values sent from one listbox to the other. I have set up code to find the control in the ontransferred event of the listboxes. Currently I am using the findcontrol method of listbox that the item is being sent to, then I try to find the control by the ID. When the code runs though the control is being set to a null value instead of the control in the listbox.

    Thanks,
    jonathan
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 21 Jun 2010 Link to this post

    Hello Jonathan,

    The provided information is not enough for us to reproduce this issue, please send us some simple code. Thanks

    Kind regards,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Civbaron
    Civbaron avatar
    20 posts
    Member since:
    Jan 2010

    Posted 21 Jun 2010 Link to this post

    Hi Yana,

    I have pasted some of the code behind that I am currently using to try to find the control so that I can set the value of the control in the list box once it is transferred.

     

    protected void lbUserNotAssigned_OnTransferred(object sender, RadListBoxTransferredEventArgs e)

     

    {

     

    if (e.DestinationListBox == lbUserAssigned)

     

    {

     

    Transform sut = new Transform(AppSettingManager.SBFDatabase);

     

     

    for (int i = 0; i < e.Items.Count; i++)

     

    {

     

    List<User> users = sut.Get(int.Parse(e.Items[i].Value));

     

     

    if (users.Count>0)

     

    {

     

    Label lblusername = (Label)lbUserAssigned.FindControl("lblUserName");

     

    lblusername.Text = siteusers[i].Name;

     

    RadComboBox rb1= (RadComboBox)lbUserAssigned.FindControl("rcbStyle");

     

    rb1.SelectedValue = siteusers[i].DefaultStyleGroupId.ToString();

     

    RadComboBox rb2= (RadComboBox)lbUserAssigned.FindControl("GroupId");

     

    rb2.SelectedValue = siteusers[i].PrimarySecurityGroupId.ToString();

     

    RadComboBox rb3= (RadComboBox)lbUserAssigned.FindControl("PrimaryGroupId");

     

    rb3.SelectedValue = siteusers[i].PrimaryNarrGroupId.ToString();

     

    RadComboBox rb4= (RadComboBox)lbUserAssigned.FindControl("PrimaryId");

     

    rb4.SelectedValue = siteusers[i].PrimaryBusinessGroupId.ToString();

    }

     

    else

     

    {

     

    Transform ut = new Transform(AppSettingManager.SBFDatabase);

     

     

    IUser user = ut.GetByUserSeq(int.Parse(e.Items[i].Value));

     

     

    Label lblusername = (Label)lbUserAssigned.FindControl("lblUserName");

     

    lblusername.Text = user.Name;

    }

    }

    }

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 24 Jun 2010 Link to this post

    Hi Jonathan,

    Please send us also the markup. Thanks in advance

    Best wishes,
    Yana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top