Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
80 views
Hi,

this is shanker am doing one project using telerik controls my requirement is in rad combo box selectedindex change event populate the details in Radgridveiw .But in edit event it,s didnot open the edit columns am face postabak error my code is 

 if (!IsPostBack)
            {
                Facility.DataSource = studentremarks.org_view_facility_lookup();
                Facility.DataBind();
                
            }
        }
        public void getdata()
        {
            grdstudentremarks.DataSource = studentremarks.sch_view_sch_student_remark_list(RadcomFiscalyear.SelectedValue.GetInteger(), Radcomclass.SelectedValue.GetInteger());
            grdstudentremarks.DataBind();
        }
        protected void Facility_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadcomFiscalyear.DataSource = Feeschedulemanager.sch_view_fiscal_year_lookup(Facility.SelectedValue.GetInteger());
            RadcomFiscalyear.DataBind();
            Radcomclass.DataSource = studentremarks.sch_view_class_lookup(Facility.SelectedValue.GetInteger());
            Radcomclass.DataBind();
        }
   protected void grdstudentremarks_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GridColumn editColumn = grdstudentremarks.MasterTableView.GetColumn("EditCommandColumn");
                if (editColumn != null) { editColumn.Visible = CanUpdate; }
                GridColumn deleteColumn = grdstudentremarks.MasterTableView.GetColumn("DeleteCommandColumn");
                if (deleteColumn != null) { deleteColumn.Visible = CanDelete; }
                if (!CanInsert)
                {
                    HideInsertCol(grdstudentremarks);
                }
                getdata();
            }
        }

please it's argent
Pavlina
Telerik team
 answered on 04 Jan 2010
6 answers
170 views

I have created a panelbar that has 3 sections.  The second section always comes up when the page is loaded.  I would like for the 1st to come up instead.  What properties would I set to make this happen?  I have had various properties set before and nothing has helped so far.  One that I was using is [  Selected="true"  ] for the section I wanted to open up on when the page loads, but to no avail.

<telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="SingleExpandedItem" Width="800px" Height="750px">     
        <Items>    
          <telerik:RadPanelItem Text="Project Search" runat="server" Selected="true" Font-Bold="true">      
            <Items>    
              <telerik:RadPanelItem Value="ProjectSearch" runat="server">     
                <ItemTemplate>    
                   ...     
                </ItemTemplate>    
              </telerik:RadPanelItem>    
            </Items>    
          </telerik:RadPanelItem>    
          <telerik:RadPanelItem Text="Contract Search" runat="server" Font-Bold="true">     
            <Items>    
              <telerik:RadPanelItem Value="ContractSearch" runat="server">     
                <ItemTemplate>    
                  ...     
                </ItemTemplate>    
              </telerik:RadPanelItem>    
            </Items>    
          </telerik:RadPanelItem>    
          <telerik:RadPanelItem Text="SOI Search" runat="server" Font-Bold="true">     
            <Items>    
              <telerik:RadPanelItem Value="SOISearch" runat="server">     
                <ItemTemplate>    
                  ...     
                </ItemTemplate>    
              </telerik:RadPanelItem>    
            </Items>    
          </telerik:RadPanelItem>    
        </Items>    
        <CollapseAnimation Duration="100" Type="None" />    
        <ExpandAnimation Duration="100" Type="InElastic" />    
    </telerik:RadPanelBar>   

FYI - I would like to use the aspx-side to set these properties instead of the cs-side.

Any help would be great.  Thanks!
Wendy Hunt
Top achievements
Rank 2
 answered on 04 Jan 2010
2 answers
66 views

I use Popup Edit Form to add new and update existing record in grid. Whe I add new records the Popup form works fine, when I want to edit existing record the popup form shows up, but I cannot type in its controls.

Any suggestions?

P.S. it is only happens at IE.

Yana
Top achievements
Rank 1
 answered on 04 Jan 2010
1 answer
143 views
I've been experimenting with the FileExplorer, specifically connecting the FileExplorer to a SQL DB based on this article. So far, this solution seems to be a fit for my current needs. But, I'd like to see if I can extend the functionality so that when certain files are opened they are opened in a RadEditor (or other text editing control - but I'd prefer a RadEditor). For example, I want to be able to edit a text file (.xml, .txt, etc...) and ultimately save the changes.

I believe the above example relies on a DBContentProvider as well as a handler, which I'm not yet quite grasping, and I suspect this might effect how a RadEditor solution is implemented. So, I'm hoping someone can help me solve my objective.

I'd also like to ask for suggestions on learning resources or the like where I can learn more about what's going on here. I know the code here says a lot but there's much of it that is still way over my head. I'm hoping for something (book, video, etc...) that "holds my hand" as it explains the ins and outs of what's going on. Perhaps a bit much to ask for but I thought I'd throw it out there.

Many thanks,
Michael
Fiko
Telerik team
 answered on 04 Jan 2010
1 answer
163 views
Hi;

I'm having an issue with a usercontrol I created. I've used this exact same method before atleast twice and it's always worked, but for some reason this isn't working as expected. I have a RadGrid inside the user control which contains 4 GridTemplateColumns. For some reason when I change the text in these columns the TextChanged event does not fire. Here is the code for the ascx file.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CmlDetailsGrid.ascx.cs" 
    Inherits="UserControls_CmlDetailsGrid" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<link href="../Styles/Styles.css" rel="stylesheet" type="text/css" /> 
<telerik:RadAjaxManagerProxy ID="RadAjaxManager_DetailsGrid" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid_CMLDetails">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid_CMLDetails" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManagerProxy> 
 
<script type="text/javascript">  
 
    function setFocus(caller, up, down, left, right) {  
        //alert(caller + ' ~ ' + up + ' ~ ' + down + ' ~ ' + left + ' ~ ' + right);  
        var keynum;  
        if (window.event) // IE  
        {  
            keynum = window.event.keyCode;  
        }  
        else if (e.which) // Netscape/Firefox/Opera  
        {  
            keynum = window.event.which;  
        }  
 
        if (keynum == 38 && up != "noControl") {  
 
            var control = $get(up);  
            control.focus();  
        }  
        else if (keynum == 40 && down != "noControl") {  
            var control = $get(down);  
            control.focus();  
        }  
        else if (keynum == 37 && left != "noControl") {  
 
            var control = $get(left);  
            control.focus();  
        }  
        else if (keynum == 39 && right != "noControl") {  
            var control = $get(right);  
            control.focus();  
        }  
    }  
      
</script> 
<div id="CMLDetailsGrid" style="height: 100%; width: 100%;">  
        <telerik:RadGrid ID="RadGrid_CMLDetails" runat="server" AllowSorting="True" Height="100%" 
        Width="100%" AutoGenerateColumns="False" AllowAutomaticUpdates="True" AllowFilteringByColumn="True" 
        OnPreRender="RadGrid_CMLDetails_PreRender">  
        <MasterTableView TableLayout="Fixed" EditMode="InPlace" DataKeyNames="cmlId" ItemStyle-Height="10px">  
            <HeaderStyle Wrap="false" Width="110px" HorizontalAlign="Center" /> 
            <Columns> 
                <telerik:GridBoundColumn DataField="cmlId" DataType="System.Int64" HeaderText="CML Id" 
                    SortExpression="cmlId" UniqueName="CML_ID" DataFormatString="<nobr>{0}</nobr>" 
                    Visible="false" /> 
                <telerik:GridBoundColumn DataField="partNum" DataType="System.String" HeaderText="Part #" 
                    SortExpression="partNum" UniqueName="partNum" DataFormatString="<nobr>{0}</nobr>" 
                    AutoPostBackOnFilter="true" /> 
                <telerik:GridBoundColumn DataField="cumPct" DataType="System.Int64" HeaderText="Cum%" 
                    SortExpression="cumPct" UniqueName="cumPct" DataFormatString="<nobr>{0}</nobr>" 
                    AutoPostBackOnFilter="true" /> 
                <telerik:GridBoundColumn DataField="extCost" DataType="System.Int64" HeaderText="Ext Cost" 
                    SortExpression="extCost" UniqueName="extCost" DataFormatString="<nobr>{0}</nobr>" 
                    AutoPostBackOnFilter="true" /> 
                <telerik:GridBoundColumn DataField="totalQty" DataType="System.Int64" HeaderText="Total Qty" 
                    SortExpression="totalQty" UniqueName="totalQty" DataFormatString="<nobr>{0}</nobr>" 
                    AutoPostBackOnFilter="true" /> 
                <telerik:GridBoundColumn DataField="moe" DataType="System.String" HeaderText="MOE" 
                    SortExpression="moe" UniqueName="moe" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="source" DataType="System.String" HeaderText="Source" 
                    SortExpression="source" UniqueName="source" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="structureQty" DataType="System.Int64" HeaderText="Part Req Qty" 
                    SortExpression="structureQty" UniqueName="structureQty" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="unitPrice" DataType="System.Int64" HeaderText="Unit Price" 
                    SortExpression="unitPrice" UniqueName="unitPrice" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="nre" DataType="System.Int64" HeaderText="NRE" 
                    SortExpression="nre" UniqueName="nre" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="nreDesc" DataType="System.String" HeaderText="NRE Desc" 
                    SortExpression="nreDesc" UniqueName="nreDesc" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridTemplateColumn DataField="arQty" DataType="System.Int64"   
                    HeaderText="AR Qty" SortExpression="arQty" UniqueName="gtcArQty">  
                    <ItemTemplate> 
                        <asp:TextBox runat="server" ID="txtArQty" Text='<%# DataBinder.Eval(Container.DataItem,"arQty") %>' 
                            AutoPostBack="true" OnTextChanged="CmlGridFieldsTextChanged" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="minBuyQty" DataType="System.Int64"   
                    HeaderText="MB Qty" SortExpression="minBuyQty" UniqueName="minBuyQty">  
                    <ItemTemplate> 
                        <asp:TextBox runat="server" ID="txtMinBuyQty" Text='<%# DataBinder.Eval(Container.DataItem,"minBuyQty") %>' 
                            AutoPostBack="true" OnTextChanged="CmlGridFieldsTextChanged" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn DataField="shrinkagePct" DataType="System.Int64"   
                    HeaderText="Shrk %" SortExpression="shrinkagePct" UniqueName="shrinkagePct">  
                    <ItemTemplate> 
                        <asp:TextBox runat="server" ID="txtShrinkagePct" Text='<%# DataBinder.Eval(Container.DataItem,"shrinkagePct") %>' 
                            AutoPostBack="true" OnTextChanged="CmlGridFieldsTextChanged" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn>                  
                <telerik:GridBoundColumn DataField="shrinkageQty" DataType="System.Int64" HeaderText="Shrk Qty" 
                    SortExpression="shrinkageQty" UniqueName="shrinkageQty" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridTemplateColumn DataField="ssAsInd" DataType="System.Int64"   
                    HeaderText="SS/AS" SortExpression="ssAsInd" UniqueName="ssAsInd">  
                    <ItemTemplate> 
                        <asp:TextBox runat="server" ID="txtSsAsInd" Text='<%# DataBinder.Eval(Container.DataItem,"ssAsInd") %>' 
                            AutoPostBack="true" OnTextChanged="CmlGridFieldsTextChanged" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn>                          
                <telerik:GridBoundColumn DataField="expDate" DataType="System.String" HeaderText="Exp Date" 
                    SortExpression="expDate" UniqueName="expDate" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="suplExpDate" DataType="System.String" HeaderText="Sup Exp Date" 
                    SortExpression="suplExpDate" UniqueName="suplExpDate" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="qteOrdType" DataType="System.String" HeaderText="Quote /Order Type" 
                    SortExpression="qteOrdType" UniqueName="qteOrdType" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="priceRecQty" DataType="System.Int64" HeaderText="Price Rec Qty" 
                    SortExpression="priceRecQty" UniqueName="priceRecQty" DataFormatString="<nobr>{0}</nobr>" /> 
                <telerik:GridBoundColumn DataField="frzInd" DataType="System.Int64" HeaderText="FRZ" 
                    SortExpression="frzInd" UniqueName="frzInd" DataFormatString="<nobr>{0}</nobr>" /> 
            </Columns> 
            <NoRecordsTemplate> 
                <div> 
                    There are no records to display.</div> 
            </NoRecordsTemplate> 
        </MasterTableView> 
        <GroupingSettings CaseSensitive="false" /> 
        <ClientSettings AllowRowsDragDrop="false" AllowKeyboardNavigation="true">  
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" /> 
            <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="1" SaveScrollPosition="true" /> 
            <Resizing AllowColumnResize="true" ClipCellContentOnResize="true" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
</div> 
 

Here is the codebehind information.

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using Harris.Common.ModelStateWrapper_ASPNET;  
using Harris.Project.Mammoth.Domain;  
using Harris.Project.Mammoth.ServiceManager;  
using Telerik.Web.UI;  
 
public partial class UserControls_CmlDetailsGrid : System.Web.UI.UserControl  
{  
    Common _common;  
    private CmlDetailsService _cmldSvc;  
    ModelStateWrapper _modelStateWrapper;  
 
    /// <summary>  
    /// Handles Page_Load event of CMLDetailsGrid control.  
    /// </summary>  
    /// <param name="sender"></param>  
    /// <param name="e"></param>  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
 
    /// <summary>  
    /// Fills the CML Details grid from the database..  
    /// </summary>  
    /// <param name="cmlId">cmlId of type long</param>  
    public void FilterCmlDetailsData(long cmlId)  
    {  
 
        if (_common == null) _common = new Common(Session, Request);  
        if (_modelStateWrapper == null) _modelStateWrapper = new ModelStateWrapper(_common.GetDictionary());  
        if (_cmldSvc == null) _cmldSvc = new CmlDetailsService(_modelStateWrapper);  
 
        RadGrid_CMLDetails.DataSource = _cmldSvc.GetCmlDetailsByCmlId(cmlId);  
        RadGrid_CMLDetails.Rebind();  
        CmlDetails_SetToolTip();  
 
    }
    #region Tooltip creation for textboxes to enable excel like grid.  
 
    /// <summary>  
    /// Prerender call to add javascript which allows tabbing through textboxes in grid.  
    /// </summary>  
    /// <param name="sender"></param>  
    /// <param name="e"></param>  
    protected void RadGrid_CMLDetails_PreRender(object sender, EventArgs e)  
    {  
        CmlDetails_SetToolTip();  
    }  
 
    /// <summary>  
    /// Returns a string used to dynamically assign the javascript for excel like movement in grid.  
    /// </summary>  
    /// <param name="self">textbox making the call.</param>  
    /// <param name="leftBox">textbox to the left of caller, "noControl" if none.</param>  
    /// <param name="rightBox">textbox to the right of caller, "noControl" if none.</param>  
    /// <param name="dataItem">current dataitem from grid.</param>  
    /// <param name="location">either top or bottom, used to determine if this is the first or last item ingrid.</param>  
    /// <returns>strSelf + "','" + strUp + "','" + strDown + "','" + strLeft + "','" + strRight;</returns>  
    private string GetTexboxAttributes(string self, string leftBox, string rightBox, GridDataItem dataItem, string location)  
    {  
 
        // Cast self as textbox since it will always have something in it.  
        TextBox txtSelf = RadGrid_CMLDetails.MasterTableView.Items[dataItem.ItemIndex].FindControl(self) as TextBox;  
        string strSelf = txtSelf.ClientID;  
 
        // Get what should be above.  
        string strUp = string.Empty;  
        if (location != "top")  
        {  
            TextBox txtUp = RadGrid_CMLDetails.MasterTableView.Items[dataItem.ItemIndex - 1].FindControl(self) as TextBox;  
            strUp = txtUp.ClientID;  
        }  
        else 
        {  
            strUp = "noControl";  
        }  
 
        // Get what should be below.  
        string strDown = string.Empty;  
        if (location != "bottom")  
        {  
            TextBox txtDown = RadGrid_CMLDetails.MasterTableView.Items[dataItem.ItemIndex + 1].FindControl(self) as TextBox;  
            strDown = txtDown.ClientID;  
        }  
        else 
        {  
            strDown = "noControl";  
        }  
 
        // Need a string for the left box in grid.  
        string strLeft = string.Empty;  
        if (leftBox == "noControl")  
        {  
            strLeft = "noControl";  
        }  
        else 
        {  
            TextBox txtLeft = RadGrid_CMLDetails.MasterTableView.Items[dataItem.ItemIndex].FindControl(leftBox) as TextBox;  
            strLeft = txtLeft.ClientID;  
        }  
 
        // Need a string for the right box in grid.  
        string strRight = string.Empty;  
        if (rightBox == "noControl")  
        {  
            strRight = "noControl";  
        }  
        else 
        {  
            TextBox txtRight = RadGrid_CMLDetails.MasterTableView.Items[dataItem.ItemIndex].FindControl(rightBox) as TextBox;  
            strRight = txtRight.ClientID;  
        }  
 
        string strAttributes = strSelf + "','" + strUp + "','" + strDown + "','" + strLeft + "','" + strRight;  
 
        return strAttributes;  
    }  
 
    /// <summary>  
    /// Called by preRender to set tool tips on each textbox in grid.  
    /// </summary>  
    private void CmlDetails_SetToolTip()  
    {  
        int itemsInGrid = RadGrid_CMLDetails.Items.Count;  
        foreach (GridDataItem dataItem in RadGrid_CMLDetails.Items)  
        {  
 
            var txtArQty = (dataItem.FindControl("txtArQty") as TextBox);  
            var txtMinBuyQty = (dataItem.FindControl("txtMinBuyQty") as TextBox);  
            var txtShrinkagePct = (dataItem.FindControl("txtShrinkagePct") as TextBox);  
            var txtSsAsInd = (dataItem.FindControl("txtSsAsInd") as TextBox);  
            //  
 
            var rowToolTip = string.Empty;  
 
            // Need to get the StructureID from the hidden gridfield  
            // so I attached it to the tooltip part of the textbox.  
            for (int ix = 0; ix < dataItem.Cells.Count; ix++)  
            {  
                if (dataItem.Cells[ix].Text != "&nbsp;")  
                {  
                    rowToolTip = dataItem.Cells[ix].Text;  
                    break;  
                }  
            }  
 
            // Set tooltips for all four textboxes.  
            txtArQty.ToolTip = rowToolTip;  
            txtMinBuyQty.ToolTip = rowToolTip;  
            txtShrinkagePct.ToolTip = rowToolTip;  
            txtSsAsInd.ToolTip = rowToolTip;  
 
            // string self, string leftBox, string rightBox, GridDataItem dataItem, string location  
            // Top row in grid.  
            if (dataItem.ItemIndex == 0)  
            {  
                // Get locations for first box left to right.  
                string strArQtyAttributes = GetTexboxAttributes(txtArQty.ID, "noControl", txtMinBuyQty.ID, dataItem, "top");  
                txtArQty.Attributes.Add("onkeydown", "setFocus('" + strArQtyAttributes + "');");  
 
                // Get locations for second box left to right.  
                string strMinBuyQtyAttributes = GetTexboxAttributes(txtMinBuyQty.ID, txtArQty.ID, txtShrinkagePct.ID, dataItem, "top");  
                txtMinBuyQty.Attributes.Add("onkeydown", "setFocus('" + strMinBuyQtyAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strShrinkagePctAttributes = GetTexboxAttributes(txtShrinkagePct.ID, txtMinBuyQty.ID, txtSsAsInd.ID, dataItem, "top");  
                txtShrinkagePct.Attributes.Add("onkeydown", "setFocus('" + strShrinkagePctAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strSsAsIndAttributes = GetTexboxAttributes(txtSsAsInd.ID, txtShrinkagePct.ID, "noControl", dataItem, "top");  
                txtSsAsInd.Attributes.Add("onkeydown", "setFocus('" + strSsAsIndAttributes + "');");  
            }  
            // Used to handle middle rows in grid.  
            else if (dataItem.ItemIndex > 0 && dataItem.ItemIndex < RadGrid_CMLDetails.MasterTableView.Items.Count - 1)  
            {  
                // Get locations for first box left to right.  
                string strArQtyAttributes = GetTexboxAttributes(txtArQty.ID, "noControl", txtMinBuyQty.ID, dataItem, "mid");  
                txtArQty.Attributes.Add("onkeydown", "setFocus('" + strArQtyAttributes + "');");  
 
                // Get locations for second box left to right.  
                string strMinBuyQtyAttributes = GetTexboxAttributes(txtMinBuyQty.ID, txtArQty.ID, txtShrinkagePct.ID, dataItem, "mid");  
                txtMinBuyQty.Attributes.Add("onkeydown", "setFocus('" + strMinBuyQtyAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strShrinkagePctAttributes = GetTexboxAttributes(txtShrinkagePct.ID, txtMinBuyQty.ID, txtSsAsInd.ID, dataItem, "mid");  
                txtShrinkagePct.Attributes.Add("onkeydown", "setFocus('" + strShrinkagePctAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strSsAsIndAttributes = GetTexboxAttributes(txtSsAsInd.ID, txtShrinkagePct.ID, "noControl", dataItem, "mid");  
                txtSsAsInd.Attributes.Add("onkeydown", "setFocus('" + strSsAsIndAttributes + "');");  
            }  
            else if (dataItem.ItemIndex == RadGrid_CMLDetails.MasterTableView.Items.Count - 1)  
            {  
                // Get locations for first box left to right.  
                string strArQtyAttributes = GetTexboxAttributes(txtArQty.ID, "noControl", txtMinBuyQty.ID, dataItem, "bottom");  
                txtArQty.Attributes.Add("onkeydown", "setFocus('" + strArQtyAttributes + "');");  
 
                // Get locations for second box left to right.  
                string strMinBuyQtyAttributes = GetTexboxAttributes(txtMinBuyQty.ID, txtArQty.ID, txtShrinkagePct.ID, dataItem, "bottom");  
                txtMinBuyQty.Attributes.Add("onkeydown", "setFocus('" + strMinBuyQtyAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strShrinkagePctAttributes = GetTexboxAttributes(txtShrinkagePct.ID, txtMinBuyQty.ID, txtSsAsInd.ID, dataItem, "bottom");  
                txtShrinkagePct.Attributes.Add("onkeydown", "setFocus('" + strShrinkagePctAttributes + "');");  
 
                // Get locations for third box left to right.  
                string strSsAsIndAttributes = GetTexboxAttributes(txtSsAsInd.ID, txtShrinkagePct.ID, "noControl", dataItem, "bottom");  
                txtSsAsInd.Attributes.Add("onkeydown", "setFocus('" + strSsAsIndAttributes + "');");  
            }  
 
        }  
    }
    #endregion  
 
    /// <summary>  
    /// Handles textchange event updates the quantity of the structure, and updates the tree.  
    /// This is used by both the WhereUsed grid and the ChildGrid.  
    /// </summary>  
    /// <param name="sender"></param>  
    /// <param name="e"></param>  
    protected void CmlGridFieldsTextChanged(object sender, EventArgs e)  
    {  
 
        TextBox txtChangeQuantity = ((TextBox)sender);  
        Int32 newQuantity = Int32.Parse(txtChangeQuantity.Text);  
        long structureId = long.Parse(txtChangeQuantity.ToolTip);  
 
        // get the structure record from the database  
        //var structureToUpdate = _structSvc.GetStructure(structureId);  
 
        //if (structureToUpdate != null)  
        //{  
        //    structureToUpdate.Qty = newQuantity;  
        //    var modStructure = _structSvc.EditStructure(structureToUpdate, _userName);  
 
        //    if (modStructure != null)  
        //    {  
        //        // Update tree with new quantity.  
        //        RadTreeView myStructureView = (RadTreeView)Parent.FindControl("StructureView");  
 
        //        _cgtree.ProcessTreeInstructions(_structSvc.TreeInstructions, myStructureView);  
        //    }  
        //    else  
        //    {  
        //        _modelStateWrapper.AddError("Structure Error", "Error updating structure data {" + structureId + "}");  
 
        //    }  
        //}  
    }  
}  
 

I've placed a break point in the CmlGridFieldsTextChanged event but it never reaches that point when the boxes are changed.

I've also tried several different RadAjaxManagerProxy settings but no luck. What I have above is almost identical to two other controls I've written, which both trip the text changed event without any problem.
<telerik:RadAjaxManagerProxy ID="RadAjaxManager_DetailsGrid" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid_CMLDetails">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid_CMLDetails" /> 
                <telerik:AjaxUpdatedControl ControlID="txtArQty" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
                <telerik:AjaxSetting AjaxControlID="txtArQty">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="txtArQty" /> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid_CMLDetails" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManagerProxy> 
Iana Tsolova
Telerik team
 answered on 04 Jan 2010
1 answer
93 views

Good day!

I'm trying to delete records from a grid via javascript (__doPostBack() method). For the __doPostBack(), I'm passing in the client ID of a RadMenu. I'm able to successfully delete records from the grid, and it refreshes ok. But if I add the RadMenu to my
AjaxSetting and the Grid as the AjaxUpdatedControl, the grid doesn't refresh anymore eventhough the loading panel appears.
Why is this so?

Thank you very much.

Pavlina
Telerik team
 answered on 04 Jan 2010
1 answer
120 views
I have a grid that allows the user to add a new row to the list of objects that is saved in view state.  The new row is added correctly, I can see them and they are populated.  When the user clicks the save button, I have a method to get loop through all the rows in the grid and save the values off to an object, everything works fine EXCEPT when I try to find the controls on my dynamically added row, it can't find any of them...Am I missing something.

So to summarize:
User clicks button - add a new object to the list of objects in viewstate, set the datasource = new list of objects
User enters data and clicks the "save question" button - Loop through all of the form data and the grid and collect values to save to object.  This is where I get the error because it can't seem to find the controls on my dynamic row.  I have attached the necessary code.

 

<telerik:RadGrid ID="RadGrid1" runat="server" PageSize="10" Skin="Default" GridLines="None" 
                                        AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" AllowMultiRowEdit="true" 
                                        ShowGroupPanel="True" GroupingEnabled="False" EnableLinqExpressions="false"   
                                        BorderWidth="1px" BorderColor="Gainsboro" 
                                        OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource"   
                                        OnItemCommand="RadGrid1_ItemCommand" OnItemDataBound="RadGrid1_ItemDataBound"   
                                        OnInsertCommand="RagGrid1_InsertCommand" 
                                    > 
                                        <PagerStyle Mode="NextPrevNumericAndAdvanced" CssClass="tbl"></PagerStyle> 
                                        <ClientSettings ReorderColumnsOnClient="false" AllowDragToGroup="true" AllowColumnsReorder="false">  
                                            <Selecting AllowRowSelect="True"></Selecting> 
                                            <ClientEvents OnRowDblClick="RowDblClick" /> 
                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="False" 
                                                ScrollHeight="250" /> 
                                        </ClientSettings> 
                                          
                                        <MasterTableView DataKeyNames="FileChecklistReferenceId" EditMode="InPlace" TableLayout="Fixed" AllowFilteringByColumn="true" AutoGenerateColumns="false" CommandItemDisplay="Top">  
                                            <EditItemStyle Font-Bold="true"/>  
                                            <Columns> 
                                                <telerik:GridTemplateColumn UniqueName="Checklist" HeaderText="Checklist">  
                                                    <ItemTemplate> 
                                                        <%#Eval("FileType")%> 
                                                    </ItemTemplate> 
                                                    <EditItemTemplate> 
                                                        <asp:DropDownList ID="ddlFileType" runat="server" CssClass="ddl" /> 
                                                        <asp:RequiredFieldValidator ID="rfvFileType" runat="server" ControlToValidate="ddlFileType" Text="*" ErrorMessage="Please Select a Checklist" SetFocusOnError="True" InitialValue="-1" ValidationGroup="SaveGroup" /> 
                                                    </EditItemTemplate> 
                                                </telerik:GridTemplateColumn> 
                                                <telerik:GridBoundColumn DataField="Reference" HeaderText="Reference" ItemStyle-Font-Bold="true" /> 
                                                <telerik:GridNumericColumn UniqueName="Threshold" ConvertEmptyStringToNull="true" DataType="System.Double" HeaderText="Threshold" NumericType="Currency" DataField="Threshold" /> 
                                                <%--<telerik:GridEditCommandColumn HeaderStyle-Width="80px"  />--%> 
                                            </Columns> 
                                        </MasterTableView> 
                                    </telerik:RadGrid> 

Code to add new row:
        protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)  
        {  
            if (e.CommandName == RadGrid.InitInsertCommandName)  
            {  
                //Get the filechecklist from Viewstate  
                List<FileChecklist> fileList = (List<FileChecklist>)ViewState["Checklists"];  
                //Add a new file checklist object to it  
                fileList.Add(new FileChecklist());  
                //Save it back to ViewState  
                ViewState["Checklists"] = fileList;  
 
                e.Canceled = true;  
                System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();  
                //the values set here must match the values types declared in the class (Model) otherwise, an exception will be thrown  
                //if any of the values do not "match" you will get a "Specified cast is not valid." exception  
                newValues["FileTypeId"] = -1;  
                newValues["FileChecklistReferenceId"] = -1;  
                newValues["Threshold"] = 0.0;  
 
                //Insert the item and rebind  
                e.Item.OwnerTableView.InsertItem(newValues);  
            }  
        } 

Data Source:
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)  
        {  
            RadGrid rg = (RadGrid)sender;  
 
            List<FileChecklist> fileList = (List<FileChecklist>)ViewState["Checklists"];  
            rg.DataSource = fileList;  
        } 

Code to get grid row values
        private void SaveFileChecklists(ref Question data)  
        {  
            List<FileChecklist> newList = new List<FileChecklist>();  
 
            foreach (GridDataItem row in RadGrid1.MasterTableView.Items)  
            {  
                int id = Convert.ToInt32(row.OwnerTableView.DataKeyValues[row.ItemIndex]["FileChecklistReferenceId"]);  
 
                FileChecklist fc = new FileChecklist();  
                DropDownList ddl = (row.FindControl("ddlFileType") as DropDownList); //null  
                TextBox tb = (row["Reference"].Controls[0] as TextBox); //throws index out of range error  
                RadNumericTextBox rtb = (row["Threshold"].Controls[0] as RadNumericTextBox);//throws index out of range error  
            }  
            data.FileChecklists = newList;  
        } 

WHAT AM I MISSING???

Mira
Telerik team
 answered on 04 Jan 2010
3 answers
197 views
Hi, we are using Q3 FileExplorer & .net 2 framework on a Windows 2003 server. We have the view, upload, delete paths set correctly, but the upload button is inactive. On the server, the security settings the Asp.net machine account, the Network and Network Service accounts have FULL CONTROL permissions applied at the root level of the site, with 'Allow inheritable permissions' Checked. I have verified that the sub folders where we are trying to upload files indeed have these permissions set as well. Does anyone know what would cause this and what I should do to get this working. I am puzzled as we have other sites on the same box configured the same way, and the file Explorer works fine (except those use Q2 Telerik rather than Q3 but I dont think this is the issue). Thanks in advance for any help on this.
Fiko
Telerik team
 answered on 04 Jan 2010
2 answers
187 views
I have a situation where one column can have either dollar amounts or plain decimal amounts (these are used as multipliers) and I need to change the DataFormatString for the cell based on the value of another cell in the row. 

We are binding the grid in the OnNeedDataSource event to a IList<>.  I've looked at the ItemDataBound event walk throughs but I can't seem to figure out how to access the DataFormatString.

How can I do this?

Thanks
Curtis


Curtis Hunter
Top achievements
Rank 1
 answered on 04 Jan 2010
1 answer
160 views
Is there a way to enter a Skype link?

<a href="skype:[Skype username]?call">Call me on Skype</a>

Does not work. It is just removed from the html-editore mode.

This is the way Skype suggest you put a button in your webb page:
<a href="skype:[Skype username]?call"><img src="http://download.skype.com/share/skypebuttons/buttons/call_blue_transparent_70x23.png" style="border: none;" width="70" height="23" alt="Skype Meâ„¢!" /></a>

Looking for a solution for this!

///Kris
Dobromir
Telerik team
 answered on 04 Jan 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?