how to get values for dynamic added controle in radgrid on button click

4 posts, 0 answers
  1. Gajanan
    Gajanan  avatar
    49 posts
    Member since:
    May 2010

    Posted 17 Aug 2015 Link to this post

    Hi,
    My requirement is Bind the grid dynamic , and add the controls like Text Box And rad Como box at run time by Item value.
    so far have done the control adding and now my grid is ready to take values from user , 
    but when user selected value from rad combo box (dynamic added control in grid), and click the save button i cannot find the Rad Combo box 
    pls suggest me the way how to get the values for dynamically added controls in Rad-grid on button click.
    below are the steps i followed
    1. Added Grid in Aspx. with Autogenerated Column = true
    2. On Item created event added dynamic controls in Grid. 
    3. bind the data to ad combo box (dynamic added control in grid) 
    4. on save Button i have to save the selected values from rad combo box (dynamic added control in grid), to data base
    in above step 1 to 3 are done , but step 4 making me trouble .

    below is code for button click.
    protected void btnSaveAll_Click(object sender, EventArgs e)
    {
        Questionnaire MyQue = Questionnaire.getQuestionnaire(mQuestionnaireid); 
        ArrayList ColumnLst = GetColumnList();
                    Dictionary<string,string> RowSplitValue = new Dictionary<string,string>();
                    foreach (GridEditableItem Item in rgPivotQuestionnaireResult.MasterTableView.Items)
                    {
                        foreach (GridColumn Column in rgPivotQuestionnaireResult.MasterTableView.RenderColumns)
                        {
                            if (ColumnLst.Contains(Column.UniqueName))
                            {
                                //RowSplitValue = new Dictionary<string, string>(Item.SavedOldValues[Column.UniqueName]);
                                if (Item[Column].Controls.Count > 0)
                                {
                                    Control ItemControle= new Control();
                                    ItemControle = Item[Column].Controls[0];
                                    if (ItemControle is TextBox)
                                    {
                                        TextBox TxtBx = (TextBox)Item[Column].Controls[0];
                                    }
                                    if (Item[Column].Controls.Count > 1)
                                    {
                                        ItemControle = Item[Column].Controls[1];
                                        if (ItemControle is RadComboBox)
                                        {
                                            RadComboBox RCB = (RadComboBox)Item[Column].Controls[1];
                                              MyQue .Answervalue = RCB.SelectedValue;
                                        }
                                    }
                                }
                            }
                        }
                    }
       MyQue .Save();
    }
  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2252 posts

    Posted 18 Aug 2015 Link to this post

    Hello,

    I have replied to your query in the other thread where you have posted. The link is found below. I suggest we continue the conversation there.

    Please avoid submitting duplicate questions in different threads. Thus, we would be able to answer your queries quicker.



    Regards,
    Viktor Tachev
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. Gajanan
    Gajanan  avatar
    49 posts
    Member since:
    May 2010

    Posted 19 Aug 2015 Link to this post

    hi,

    My problem is resolved i refer the below link to resolve my problem

    http://www.telerik.com/forums/get-checkbox-control-added-dynamically-in-gridtemplate-column​

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2252 posts

    Posted 24 Aug 2015 Link to this post

    Hello Gajanan,

    I am glad that the issue was resolved. Thank you for sharing your solution with the community. This could help someone with similar scenario.

    Regards,
    Viktor Tachev
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top