<
telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >
<
asp:Image id="imgLoading" runat="server" ></asp:Image>
</
telerik:RadAjaxLoadingPanel>
<
telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
< telerik:RadGrid ID="CWGrid" runat="server" Width="100%" OnNeedDataSource="CWGrid_NeedDataSource" >
</
telerik:RadGrid>
</
telerik:RadAjaxPanel>
public
void CWGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
DataSet objSD = SetData();
if (objDS.Tables.Count > 0)
CWGrid.DataSource = objDS;
}
var i == <%= OGridItem_ItemIndex %>
but, If I set the value in Server code, and on Client Side try to Access it, I get it's previous (initial value) , not it's new current value??
I have RadAjax Manager and grid on page and all ajaxified ControlId's and UpdatedControls in it. And that Server set Viewstate Var is not nor seems to be able to be.
Script and Grid are wrapped in RadCodeBlocks.
If I try it a few times, it always returns the Previous not current value.
The current Value is set in C# after a straightforward __DoPOstback(Arg_Source, EventArgs). The rest of the Controls on the page are set for Ajax postbacks as per the RadAjaxManager.
How do I retrieve the current value of this ViewState Var when in JS??
Thx
Neal
<telerik:RadTreeView ID="rtvVendor" runat="server" CheckBoxes="True"CheckChildNodes="True" Skin="Outlook" TriStateCheckBoxes="true" Width="500px"Height="400px" BorderStyle="Solid" BorderColor="#4888A2" BorderWidth="1px" OnNodeCheck="rtvVendor_NodeCheck" ><%-- OnNodeDataBound="rtvVendor_NodeDataBound">--%> </telerik:RadTreeView>
#region TreeVendor private void BindToDataTable(RadTreeView treeView) { char[] separator = new char[] { ':' }; string[] strSplitArr = rcbAssociate.SelectedValue.Split(separator); string FullAssocID = strSplitArr[0]; SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecialistMappingConnectionString"].ConnectionString); SqlCommand sqlCmd = new SqlCommand("uspSpecialistMapping_LoadFOBTree3", connection); SqlDataAdapter adapter = new SqlDataAdapter(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@FullAssocID", FullAssocID); sqlCmd.Parameters.AddWithValue("@PDiv", rcbPDiv.SelectedValue); DataTable dataTable = new DataTable(); adapter.SelectCommand = sqlCmd; adapter.Fill(dataTable); //Added by RB 5/24/2010 RadTreeNodeBinding binding = new RadTreeNodeBinding(); binding.CheckedField = "IsChecked"; treeView.DataBindings.Add(binding); binding = new RadTreeNodeBinding(); binding.ExpandedField = "IsChecked"; treeView.DataBindings.Add(binding); treeView.DataTextField = "FOBName"; treeView.DataFieldID = "FOBID"; treeView.DataValueField = "FOBID"; treeView.DataFieldParentID = "ParentID"; treeView.DataSource = dataTable; treeView.DataBind(); } #endregion #region SaveValues protected void btnSubmit_Click(object sender, EventArgs e) { if (!rcbPDiv.SelectedValue.Equals("") && !rcbAssociate.SelectedValue.Equals("")) { char[] separator = new char[] { ':' }; string[] strSplitArr = rcbAssociate.SelectedValue.Split(separator); string FullAssocID = strSplitArr[0]; //Delete old cheched Vendors. using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecialistMappingConnectionString"].ConnectionString)) { SqlCommand sqlCmd = new SqlCommand("uspSpecialistMapping_DeleteVendor", connection); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@FullAssocID", FullAssocID); sqlCmd.Parameters.AddWithValue("@PDiv", rcbPDiv.SelectedValue); try { connection.Open(); sqlCmd.ExecuteNonQuery(); } catch (SqlException sqlEx) { throw; } } ShowCheckedNodes(rtvVendor, nodesClientside, FullAssocID); } } private void ShowCheckedNodes(RadTreeView treeView, Label label, string FullAssocID) { string message = string.Empty; int count = 0; IList<RadTreeNode> nodeCollection = treeView.CheckedNodes; foreach (RadTreeNode node in nodeCollection) { if (node.CheckState.ToString().Equals("Checked")) { string tmp = node.Value; if (tmp.IndexOf("3", 0, 1) != -1) { string strDeptID = tmp.Substring(1, 4); string strVendorID = tmp.Substring(5, 4); using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecialistMappingConnectionString"].ConnectionString)) { SqlCommand sqlCmd = new SqlCommand("uspSpecialistMapping_InsertVendor", connection); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@FullAssocID", FullAssocID); sqlCmd.Parameters.AddWithValue("@Dept", strDeptID); sqlCmd.Parameters.AddWithValue("@Vendor", strVendorID); try { connection.Open(); count += sqlCmd.ExecuteNonQuery(); } catch (SqlException sqlEx) { throw; } } message += node.Value + "[" + node.FullPath + "]" + "<br/>"; } } } if (count > 0) { string script = "alert('Changes saved successfully!')"; RadScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), script, true); } } #endregion protected void rtvVendor_NodeCheck(object sender, RadTreeNodeEventArgs e) { rtvVendor.TriStateCheckBoxes = false; if (e.Node.Checked) e.Node.CheckChildNodes(); else e.Node.UncheckChildNodes(); for (int i = 0; i < e.Node.Nodes.Count; i++) e.Node.Nodes[i].Enabled = !e.Node.Checked; rtvVendor.TriStateCheckBoxes = true; } <script language="javascript" type="text/javascript"> function Execute(command, args) { var o = new Object(); o.get_value = function() { return args; } o.get_commandName = function() { return command; } $find("txtText").fire(command, o); alert(args); } </script> <select size="1" name="cboFont" onchange="return Execute('FontName',this.value)" > <option value="Arial">Arial</option> <option value="Time New Roman">Time New Roman</option> </select> <select size="1" name="cboSize" onchange="return Execute('RealFontSize',this.value)"> <option value="15">15</option> <option value="18">18</option> <option value="20">20</option> </select>