Hi Gents,
I am currently experiencing the following problem.
I allow a user to dynamically add values to a dropdown using the following.
This then goes to a web method which returns me the Id of the added language which i subsequently append to a dropdown on the page. This dropdown exists within a RadAjaxpanel
However when i attempt to save my page, the selected value in the Language dropdown is "", i believe this is due to the server (viewstate) not knowing about the language that was added on the clientside.
If i use the Telerik DropDownList control will i be able to overcome this problem as i need some assistance
Kind Regards
I am currently experiencing the following problem.
I allow a user to dynamically add values to a dropdown using the following.
1.<asp:DropDownList ID="ddlPrevelantHomeLanguage" runat="server" DataValueField="LanguageID"2. DataTextField="Description" />01.// Add Language function02. function OnClientCloseLanguage(oWnd, args) {03. //get the transferred arguments04. var arg = args.get_argument();05. if (arg) {06. var language = arg.language;07. 08. var data = JSON.stringify({09. language: language10. });11. 12. $.ajax({13. type: "POST",14. url: "Source.aspx/AddLanguage",15. data: data,16. contentType: "application/json; charset=utf-8",17. dataType: "json",18. success: function (msg) {19. var result = msg.d;20. var langaugeDropDown = $('#<%= ddlPrevelantHomeLanguage.ClientID %>');21. langaugeDropDown.append($('<option value="' + result + '">' + language + '</option>'));22. },23. error: function (xhr, error) {24. radalert("<strong>An Error occured when adding the language.</strong>", 225, 100, "Error", "");25. }26. });27. }28. }This then goes to a web method which returns me the Id of the added language which i subsequently append to a dropdown on the page. This dropdown exists within a RadAjaxpanel
01./// <summary>02. /// Adds the language.03. /// </summary>04. /// <param name="language">The language.</param>05. /// <returns></returns>06. [WebMethod]07. public static int AddLanguage(string language)08. {09. MarketingDao staticMarketingDao = DataAccessFactory.Create<MarketingDao>();10. 11. Language entityLanguage = new Language();12. entityLanguage.Description = language;13. 14. staticMarketingDao.Insert<Language>(entityLanguage);15. staticMarketingDao.SubmitChanges();16. 17. return entityLanguage.LanguageId;18. }However when i attempt to save my page, the selected value in the Language dropdown is "", i believe this is due to the server (viewstate) not knowing about the language that was added on the clientside.
If i use the Telerik DropDownList control will i be able to overcome this problem as i need some assistance
Kind Regards
