Hi, I have the following scenario/code and I'm looking for a solution to this problem or a different way of doing it entirely!
I need a page with a number of tabs, each tab should display a question (Label) and an answer (RadEditor). The number of questions can vary so I need a way of doing this dynamically. Currently I have solved this problem by using a user control with the Label and RadEditor and loading this dynamically when (a) the page is loaded and !isPostBack (b) the radTab tabClick event fires.
My problem now is that if a user were to edit the text in the radEditor for Question 1 (for example) then clicks the tab for Question 2, the modified answer is lost. I need a way of either saving this answer to the database when the tabstrip is clicked or at least storing it as a session variable. This would be straight forward if only I could find a way to access the radEditor of Question 1 once the tab for Question two has been clicked!
When the tab is clicked the Page_Load method fires first then the tabClick event fires, so I have been using the following code:
When the page is first loaded (!isPostback):
on PostBack:
I have tried various similar ways of doing this and they always fail as when debugging, the RadMultipage, rmp, is always null even though the Type, type, is an ASP.innovation_project_aspx as expected. I think I could be doing this totally wrong but my mind is now locked on this method!
Any solutions or alternate ideas would be greatly appreciated, I can try and explain further or post more code if required. Thanks in advance.
I need a page with a number of tabs, each tab should display a question (Label) and an answer (RadEditor). The number of questions can vary so I need a way of doing this dynamically. Currently I have solved this problem by using a user control with the Label and RadEditor and loading this dynamically when (a) the page is loaded and !isPostBack (b) the radTab tabClick event fires.
My problem now is that if a user were to edit the text in the radEditor for Question 1 (for example) then clicks the tab for Question 2, the modified answer is lost. I need a way of either saving this answer to the database when the tabstrip is clicked or at least storing it as a session variable. This would be straight forward if only I could find a way to access the radEditor of Question 1 once the tab for Question two has been clicked!
When the tab is clicked the Page_Load method fires first then the tabClick event fires, so I have been using the following code:
When the page is first loaded (!isPostback):
ASP.Question question = new ASP.Question(); |
question.LoadControl("./Question.ascx"); |
question.ID = "question1"; |
question.questionNumber = 1; |
question.questionTable = questionTable; |
RadMultiPage1.FindControl("RadPageView1").Controls.Add(question); |
Session["Current Question"] = 1; |
on PostBack:
int currentQuestion = Convert.ToInt32(Session["Current Question"]); |
Type type = sender.GetType(); |
ASP.innovation_project_aspx myPage = sender as ASP.innovation_project_aspx; |
RadMultiPage rmp = myPage.FindControl("RadMultiPage1") as RadMultiPage; |
RadPageView rpv = rmp.FindControl("RadPageView" + currentQuestion) as RadPageView; |
ASP.Question aspq = rpv.FindControl("question1") as ASP.Question; |
RadEditor re = aspq.FindControl("RadEditor1") as RadEditor; |
Any solutions or alternate ideas would be greatly appreciated, I can try and explain further or post more code if required. Thanks in advance.