or

<
script type="text/javascript">
function SetFocusOnRadEditor(clientId)
{
var editor = $find(clientId); //get a reference to RadEditor client object
editor.setFocus();
//set the focus on the the editor
}
</
script>
I have a fairly simple grid that onyl has 2 columns in it, Key and Value. It is bound to an ArrayList that contains a struct object. Everything thing works as expected, but when I try and get the value from the EditForm it always returns the original value. Not the value that the user has input. I've tried to approach this from a few different examples on the Website, but I have had no luck thus far. Any ideas on how to get the new value? Below is my code.
Thanks!
Code Behind
| using System; |
| using System.Collections; |
| using System.Configuration; |
| using System.Data; |
| using System.Linq; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using Telerik.Web.UI; |
| public partial class Controls_Settings_AppSettings : System.Web.UI.UserControl |
| { |
| TelerikSkinning glb = new TelerikSkinning(); |
| string skinName = String.Empty; |
| public struct appKeys |
| { |
| string mKey, mValue; |
| public appKeys(string key, string value) |
| { |
| this.mKey = key; |
| this.mValue = value; |
| } |
| public string Key |
| { |
| get |
| { |
| return mKey; |
| } |
| set |
| { |
| mKey = value; |
| } |
| } |
| public string Value |
| { |
| get |
| { |
| return mValue; |
| } |
| set |
| { |
| mValue = value; |
| } |
| } |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| { |
| SetTelerikTheme(); |
| } |
| SetGridSource(); |
| } |
| protected void SetGridSource() |
| { |
| ArrayList keyList = new ArrayList(); |
| foreach (string setting in ConfigurationManager.AppSettings.Keys) |
| { |
| appKeys key = new appKeys(setting, ConfigurationManager.AppSettings[setting]); |
| keyList.Add(key); |
| } |
| gridSettings.DataSource = keyList; |
| gridSettings.DataBind(); |
| } |
| protected void SetTelerikTheme() |
| { |
| string xmlFile = Server.MapPath("~/App_Themes/" + Page.Theme + "/SkinSettings.xml"); |
| skinName = glb.GetTextBoxSkin(xmlFile); |
| } |
| protected void gridSettings_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| //Get Configuration |
| Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); |
| if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) |
| { |
| GridEditableItem edititem = (GridEditableItem)e.Item; |
| TextBox txtKey = (TextBox)edititem["Key"].Controls[0]; |
| string strKey = txtKey.Text; |
| TextBox txtValue = (TextBox)edititem["Value"].Controls[0]; |
| string strVal = txtValue.Text; |
| //Set Value |
| KeyValueConfigurationElement key = config.AppSettings.Settings[strKey]; |
| key.Value = strVal; |
| } |
| // Save the configuration file. |
| config.Save(); |
| // Force a reload of the changed section. |
| ConfigurationManager.RefreshSection("appSettings"); |
| } |
| } |
User Control
| <%@ Control Language="C#" AutoEventWireup="true" CodeFile="AppSettings.ascx.cs" Inherits="Controls_Settings_AppSettings" %> |
| <%@ Register Assembly="Telerik.Web.UI, Version=2007.3.1314.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" |
| Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <telerik:RadGrid ID="gridSettings" runat="server" AllowSorting="True" AutoGenerateColumns="False" |
| GridLines="None" Skin="Office2007" OnUpdateCommand="gridSettings_UpdateCommand"> |
| <GroupPanel ID="GroupPanel" Style="width: 100%;"> |
| </GroupPanel><ExportSettings> |
| <Pdf FontType="Subset" PaperSize="Letter" /> |
| <Excel Format="Html" /> |
| </ExportSettings> |
| <MasterTableView CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" |
| Dir="LTR" Frame="Border" TableLayout="Auto" AllowAutomaticUpdates="false" AllowAutomaticDeletes="false" |
| AllowAutomaticInserts="false" EditMode="InPlace" DataKeyNames="Key"> |
| <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
| Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
| Resizable="False" Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Key" FilterListOptions="VaryByDataType" |
| ForceExtractValue="Always" HeaderText="Key" SortExpression="Key" UniqueName="Key"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="Value" FilterListOptions="VaryByDataType" |
| ForceExtractValue="Always" HeaderText="Value" SortExpression="Value" UniqueName="Value"> |
| </telerik:GridBoundColumn> |
| <telerik:GridEditCommandColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridButtonColumn CommandName="Delete" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
| Text="Delete" UniqueName="column"> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <EditFormSettings> |
| <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"> |
| </EditColumn> |
| </EditFormSettings> |
| </MasterTableView></telerik:RadGrid> |
| Telerik.Web.UI.GridScrolling.callBaseMethod(this,"dispose"); |
| },_initializeDimensions:function(){ |
| var _1=this; |
| this.applyFrozenScroll(); |
| this.onWindowResize(); |
| this.initializeAutoLayout(); |
| this._owner.get_element().RadResize=function(){ |
| _1.onWindowResize(); |
| }; |
| if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){ |
| this._onResizeDelegate=Function.createDelegate(this,this.onWindowResize); |
| setTimeout(function(){ |
| $addHandler(window,"resize",_1._onResizeDelegate); |
| },0); |
| }else{ |
| this._onResizeDelegate=Function.createDelegate(this,this.onWindowResize); |
| $addHandler(window,"resize",this._onResizeDelegate); |
| } |
| this._owner.get_element().RadShow=function(){ |
| _1.OnWindowResize(); |
| }; |
| },applyFrozenScroll:function(){ |
| this.isFrozenScroll=false; |
| this._frozenScroll=$get(this._owner.ClientID+"_Frozen"); |
| var _2=Telerik.Web.UI.Grid.getScrollBarHeight(); |
| if(this._frozenScroll){ |
| var _3=$get(this._owner.ClientID+"_FrozenScroll"); |

| public partial class DynamicCombo : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| XmlDataSource1.XPath = "/filters/whiteboard/product[@id='WEATHER']/filters/region/option"; |
| //create a new combobox |
| RadComboBox comboBoxRegion = new RadComboBox(); |
| this.Controls.Add(comboBoxRegion); |
| comboBoxRegion.ID = "comboBoxRegion"; |
| comboBoxRegion.DataTextField = "value"; |
| comboBoxRegion.DataSourceID = XmlDataSource1.ID; |
| comboBoxRegion.ItemTemplate = new cbItemTemplate(); |
| comboBoxRegion.DataBind(); |
| } |
| } |
| public class cbItemTemplate : ITemplate |
| { |
| public void InstantiateIn(Control container) |
| { |
| Label label = new Label(); |
| label.ID = "ItemLabel"; |
| label.Text = "Text"; |
| label.DataBinding += new EventHandler(OnDisplayDataBinding); |
| container.Controls.Add(label); |
| } |
| void OnDisplayDataBinding(object sender, EventArgs e) |
| { |
| Label label = (Label)sender; |
| RadComboBoxItem comboboxitem = (RadComboBoxItem)label.BindingContainer; |
| label.Text = (string)DataBinder.Eval(comboboxitem, "Text"); |
| } |
| } |