This is a migrated thread and some comments may be shown as answers.

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

3 Answers 220 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gajanan
Top achievements
Rank 2
Gajanan asked on 18 Aug 2015, 04:57 AM
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();
}

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 18 Aug 2015, 01:10 PM
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
0
Gajanan
Top achievements
Rank 2
answered on 20 Aug 2015, 04:29 AM

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​

0
Viktor Tachev
Telerik team
answered on 24 Aug 2015, 11:15 AM
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
Tags
Grid
Asked by
Gajanan
Top achievements
Rank 2
Answers by
Viktor Tachev
Telerik team
Gajanan
Top achievements
Rank 2
Share this question
or