We've got a PanelBar that is built dynamically from the code behind with values pulled from a database. We're using the itemdatabound even to add a textbox control to each entry at the third level. This part is working great due to some excellent input from the Telerik support staff.
The idea now is for the user to enter scores into each textbox which are then saved when they click a save button. I'm having trouble figuring out how to access the dynamically built controls and then how to put it into a foreach loop so that we can save those values back to the database.
Trying to adapt the example from the Telerik help doesn't seem like it would work since the control is dynamically bult:
TextBox Score = (TextBox)RadScoringPanel.FindItemByValue("?").FindControl("?");
So for instance the panelbar looks something like this:
- Math Scores
--December
---John [text box]
---Mary [text box]
--January
---John [text box]
---Mary [text box]
-English Scores
--etc.
< - Save - >
So when the scores are entered and then the save button is clicked I need to retrieve them and then put them into a:
"foreach (e.item..." type loop but this is where we're stuck. Can't figure out how to retrieve the value and also how to identify each panel line item for the foreach loop statement. Just to make it a bit more complicated I need to also pull the ID/Value for each level of the hierarchy for the item so that we can save it appropriately.
For instance for John's December Math Score I would need the ID for "Math Scores" (level 1), the ID for "December" (level 2) and the ID for John along with the Value in the textbox so that we can associate the score correctly.
Any direction/pointers would be greatly appreciated.
thanks
The idea now is for the user to enter scores into each textbox which are then saved when they click a save button. I'm having trouble figuring out how to access the dynamically built controls and then how to put it into a foreach loop so that we can save those values back to the database.
Trying to adapt the example from the Telerik help doesn't seem like it would work since the control is dynamically bult:
TextBox Score = (TextBox)RadScoringPanel.FindItemByValue("?").FindControl("?");
So for instance the panelbar looks something like this:
- Math Scores
--December
---John [text box]
---Mary [text box]
--January
---John [text box]
---Mary [text box]
-English Scores
--etc.
< - Save - >
So when the scores are entered and then the save button is clicked I need to retrieve them and then put them into a:
"foreach (e.item..." type loop but this is where we're stuck. Can't figure out how to retrieve the value and also how to identify each panel line item for the foreach loop statement. Just to make it a bit more complicated I need to also pull the ID/Value for each level of the hierarchy for the item so that we can save it appropriately.
For instance for John's December Math Score I would need the ID for "Math Scores" (level 1), the ID for "December" (level 2) and the ID for John along with the Value in the textbox so that we can associate the score correctly.
Any direction/pointers would be greatly appreciated.
thanks