Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
469 views
Hi guys,
We're encountering a very strange issue with RadComboBox. The Telerik.Web.UI version used is RadControls for ASPNET AJAX Q3 2008.
Using IE7, when getting the items from a WebService, we get the following error:

invalid web service call, missing value for parameter: 'context'.

The RadComboBox is added at runtime, in the following manner:
RadComboBox ddlPublisher = new RadComboBox(); 
tdPublisher.Controls.Add(ddlPublisher); 
 
ddlPublisher.ID = "ddlPublisher"; 
ddlPublisher.Width = Unit.Pixel(200); 
ddlPublisher.EnableLoadOnDemand = true; 
//ddlPublisher.ExpandEffect = RadComboBoxExpandEffect.Fade; 
ddlPublisher.ItemRequestTimeout = 500; 
ddlPublisher.OnClientDropDownOpening = "ddlRad_OnClientDropDownOpening"; 
ddlPublisher.OnClientSelectedIndexChanged = "ddlPublisher_SelectedIndexChanged"; 
ddlPublisher.WebServiceSettings.Method = "GetCompanies"; 
ddlPublisher.WebServiceSettings.Path = "~/WebService/Company.asmx"; 
ddlPublisher.MarkFirstMatch = true; 
ddlPublisher.EnableViewState = false; 
 
if (!row.IsPUBLISHER_IDNull()) { 
    ddlPublisher.Text = row.PUBLISHER_DESCR; 
    ddlPublisher.SelectedValue = row.PUBLISHER_ID.ToString(); 
} 

The webservice that feeds the combobox is implemented in the following manner:
[WebMethod(EnableSession=true)] 
public RadComboBoxItemData[] GetCompanies(object context) { 
     
    IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context; 
    List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(); 
    RadComboBoxItemData itemData; 
 
    //get the search string from the combo 
    string searchText = contextDictionary["Text"].ToString(); 
    if (searchText.Length < 3) { 
        return result.ToArray(); 
    } 
 
    //.. db call to retrieve companies, and put them into the result array 
 
 
    return result.ToArray(); 
} 


What is strange is that the failure happens only on the production machine. I cannot reproduce it on my dev machine (therefore I cannot send you a project that shows the problem :( ). Even more stranger is that the problem doesn't appear on FF or Chrome, only on IE (7&8, did not test it in 6). I tried to reproduce it on my dev machine by changing the Anonymous access on / off (the application uses Integrated Windows Authentication), with no luck.

Another thing to note is that once I open Fiddler to see what is going on, the ws call for the items works as expected. The request works with Fiddler opened! Once I close Fiddler, bang!, the error message reapears.

I'm sure that this problem is hard to reproduce, but i'm almost sure that this has to do with the server configuration: Here is some data:

Win2003, iis6
Integrated Windows Authentication
ASPNET 2.0
App runs as site, not as virtual directory.

Because this happens on prod machine, every help that comes ASAP is much apreciated.
Thank you in advance.

Lucian
Piyush Bhatt
Top achievements
Rank 2
 answered on 23 Feb 2010
1 answer
120 views




    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false">  
    <MasterTableView Width="100%" DataKeyNames="InvID" EnableNoRecordsTemplate="true" Name="MainTable" EditMode="EditForms"  > 
<Columns> 
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" /> 
            <telerik:GridBoundColumn HeaderText="" DataField="OrgID" UniqueName="OrgID" Display="false" ReadOnly="true"  ></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="Project" DataField="Organization" UniqueName="Organization" ReadOnly="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="Stock Number" DataField="StockNumber" ReadOnly="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="Total OH" DataField="OH"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="Location" DataField="Location" UniqueName="Location" ReadOnly="true"></telerik:GridBoundColumn> 
            <telerik:GridBoundColumn HeaderText="Serial" DataField="Serial" UniqueName="Serial" ReadOnly="true"></telerik:GridBoundColumn> 
 
</Columns> 
</MasterTableView> 
    </telerik:RadGrid> 

I have my radgrid using the editform mode to edit a column. IF there is more than 1 record within the grid and the edit command button is selected all rows disapear except the one selected for edit. The edit forms does not display until only one record is present. 

If one 1 row exsit the editform displays correctly.

Would anyone know why this might be happending and how to fix it?

 


Thanks


Dwayne Starkey
Top achievements
Rank 1
 answered on 23 Feb 2010
1 answer
83 views
I am using a RadGrid that contains a GridTemplateColumn.  This GridTemplateColumn contains a FilterTemplate as well as an ItemTemplate.  The FilterTemplate is a RadComboBox.  The ItemTemplate is a Label.  The table is displaying the string representation of an ID.

I want to run a sort based on the string displayed in the Label.  However, since this data is not databound, it will not let me.  It will allow me to run a sort based off of the underlying "Value" of this data.  (The Value = RoleID and the Label contains the corresponding RoleName.)

How can I do this?  I want to sort the GridTemplateColumn based on what is displayed in the ItemTemplate of this column (the Label).

Thanks!
Dave
robertw102
Top achievements
Rank 1
 answered on 23 Feb 2010
3 answers
247 views
I have a server side method that given a string of JScript as an input returns a compressed "minified" version.

I want to run some code after the page has loaded to find all RadCodeBlocks and RadScriptBlocks and minify their content before the page is finally rendered in the browser.

I can do this for some RadScriptBlocks but not all of them.

Some of them simply appear to have no sub controls at all and so I can't get what they currently contain in order to minify them.

I call something similar to the following in every page's Page_PreRender,

 
        public static void MinifyAllPageJScript(ControlCollection PageControls)  
        {  
            foreach (Control pageControl in PageControls)  
            {  
                if ((pageControl as RadScriptBlock) != null ||  
                    (pageControl as RadCodeBlock) != null)  
                {  
                    foreach (Control script in pageControl.Controls)  
                    {  
                        if ((script as LiteralControl) != null)  
                        {  
                            (script as LiteralControl).Text = Common.CompressJS((script as LiteralControl).Text);  
                        }  
                    }  
                }  
                MinifyAllPageJScript(pageControl.Controls);  
            }  
        } 

Like I say, it successfully finds all the RadScriptBlocks and RadCodeBlocks on every page but some of them have Controls.Count = 0 and so I can't get at their content to correct it. Have tried calling my MinifyAllPageJScript from various event methods but with no luck.

Little help?

Regards
ADe
robertw102
Top achievements
Rank 1
 answered on 23 Feb 2010
2 answers
151 views

 

I have a page with a command button and a Rad window that has a content template that contain a user control. The user control has a little JavaScript for custom validations. Everything works fine until I try to use an Ajax manager. When I hook the toolbar button to the Rad windows on the default page everything breaks. I have attached the code for what I am trying to do, if you disable the Ajax manager on the default page my little program works great, however if you enable and configure the Ajax and everything breaks. Currently the Ajax manager is enabled, try running it as it is and then disable Ajax and you will see what I mean.  The first time you click the  tool bar button it appears that  everything is fine, however  if you click cancel and then click the tool bar again the user control is rendered partly and is garbled. Additionally none of the JavaScript on the user control works.
This is not my entire project just a snipit there is a lot more going on and all the other Ajax works fine, I would like to use Ajax in this scenario to avoid post back on the tool bar button click that displays the rad window that has the user control to flow with therest of my project in terms of no post backs and everything else Ajaxified. Please see attached and help if you can. The data on the user control list box comes from the North wind data base Customers Company Name.  Thanks Ken G.

 

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<%@ Register Src="Controls/CreateMessageRadListBox.ascx" TagName="CreateMessageRadListBox" TagPrefix="uc" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2009.3.1208.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <telerik:RadToolBar ID="RadToolBar1" runat="server" OnButtonClick="RadToolBar1_ButtonClick" Width="100px">

        <Items>

            <telerik:RadToolBarButton runat="server" Text="UC RadListBox">

            </telerik:RadToolBarButton>

        </Items>

    </telerik:RadToolBar>

    <telerik:RadWindow ID="rwUserControlListBox" runat="server" Behaviors="Move" Height="630px" KeepInScreenBounds="True" Modal="true" Overlay="True" Skin="Office2007" Title="Create Message" Visible="false" VisibleOnPageLoad="true" VisibleStatusbar="false" Width="800px">

        <ContentTemplate>

            <uc:CreateMessageRadListBox ID="CreateMessageRadListBox" runat="server" OnCreatedMessage="ucCreateMessage_OnCreateMessage" OnCancel="ucCreateMessage_OnCancel" />

        </ContentTemplate>

    </telerik:RadWindow>

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

    </telerik:RadScriptManager>

    <br />

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="RadToolBar1">

                <UpdatedControls>

                    <telerik:AjaxUpdatedControl ControlID="rwUserControlListBox" />

                </UpdatedControls>

            </telerik:AjaxSetting>

        </AjaxSettings>

    </telerik:RadAjaxManager>

    </form>

</body>

</html>

 

Default.aspx.cs

using System;

using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page {

    protected void RadToolBar1_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e) {

        switch (e.Item.Text) {

            case "UC RadListBox":

                rwUserControlListBox.Visible = true;

                break;

        }

    }

    protected void ucCreateMessage_OnCreateMessage(object sender, EventArgs e) {

        rwUserControlListBox.Visible = false;

    }

    protected void ucCreateMessage_OnCancel(object sender, EventArgs e) {

        rwUserControlListBox.Visible = false;

    }

}

 

CreateMessageRadListBox.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CreateMessageRadListBox.ascx.cs" Inherits="Controls.CreateMessageRadListBox" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2009.3.1208.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<body style="font-family: Calibri">

    <telerik:RadCodeBlock runat="server" ID="rcbjs">

        <script type="text/javascript">

            function checkForDuplicateSelection(sender, args) {

                var usedField = new Array();

                var radUpload = $find('<%= ruFileUpload.ClientID %>');

                var fileInputs = radUpload.getFileInputs();

                var duplicateFieldFlag = false;

                for (var i = 0; i < fileInputs.length; i++) {

                    var fileName = fileInputs[i].value.substring(fileInputs[i].value.lastIndexOf("\\") + 1, fileInputs[i].value.length);

                    for (var j = 0; j < usedField.length; j++) {

                        //If at least one duplicate field exists

                        //the emptyFieldFlag is being raised

                        if (fileName == usedField[j]) {

                            duplicateFieldFlag = true;

                            //The first invalid file input

                            //field receives focus

                            radUpload.clearFileInputAt(i);

                            fileInputs[i].focus();

                            break;

                        }

                    }

                    if (duplicateFieldFlag) {

                        args.IsValid = false;

                        return;

                    }

                    if (fileInputs[i].value.length != 0) {

                        usedField[usedField.length] = fileName;

                    }

                }

                args.IsValid = true;

            }

            function ValidationCriteria(source, args) {

                var listbox = $find('<%= rlbRecipients.ClientID %>');

                var check = 0;

                var items = listbox.get_items();

                for (var i = 0; i <= items.get_count() - 1; i++) {

                    var item = items.getItem(i);

                    if (item.get_checked()) {

                        check = 1;

                    }

                }

                if (check)

                    args.IsValid = true;

                else

                    args.IsValid = false;

            }

        </script>

    </telerik:RadCodeBlock>

    <table style="width: 100%">

        <tr valign="top">

            <td style="width: 220px;">

                <asp:Label ID="lblSentTo" runat="server" Font-Bold="True" Text="Send To :"></asp:Label>

                <asp:CustomValidator ID="cvReciepients" runat="server" ClientValidationFunction="ValidationCriteria" ErrorMessage="Reciepient Required" Font-Bold="True"></asp:CustomValidator>

                <telerik:RadListBox ID="rlbRecipients" runat="server" CheckBoxes="True" Width="100%" Height="570px" Skin="Office2007" DataKeyField="Company" DataSortField="Company" DataSourceID="SqlDataSource1" DataTextField="Company" Style="top: 0px; left: 0px">

                </telerik:RadListBox>

            </td>

            <td>

                <telerik:RadUpload ID="ruFileUpload" runat="server" Skin="Office2007" MaxFileInputsCount="5" BorderColor="White" BorderStyle="Solid" BorderWidth="1px">

                </telerik:RadUpload>

                <asp:CustomValidator ID="RadUploadDuplicateFieldsValidator" runat="server" ClientValidationFunction="checkForDuplicateSelection" Display="Dynamic" Font-Bold="True">

                 Duplicate File Removed! Only ONE Version of the Same File can be Attached!

                </asp:CustomValidator>

                <asp:Button ID="btnSendMessage" runat="server" OnClick="btnSendMessage_Click" Text="Send" />

                <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click" CausesValidation="False" Height="26px" />

            </td>

        </tr>

    </table>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Northwind 20071SQLConnectionString %>" SelectCommand="SELECT [Company] FROM [Customers]"></asp:SqlDataSource>

    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">

        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="chkPriorityMessage">

                <UpdatedControls>

                    <telerik:AjaxUpdatedControl ControlID="chkReadReceipt" />

                </UpdatedControls>

            </telerik:AjaxSetting>

        </AjaxSettings>

    </telerik:RadAjaxManagerProxy>

</body>

 

CreateMessageRadListBox.ascx.cs

using System;

using System.Web.UI;

 

 

namespace Controls {

    public partial class CreateMessageRadListBox : UserControl {

        public event EventHandler CreatedMessage;

        protected void OnCreatedMessage(EventArgs e) {

            if (CreatedMessage != null)

                CreatedMessage(this, e);

        }

        public event EventHandler Cancel;

        protected void OnCancel(EventArgs e) {

            if (Cancel != null)

                Cancel(this, e);

        }

        protected void btnSendMessage_Click(object sender, EventArgs e) {

            OnCreatedMessage(e);

        }

        protected void btnCancel_Click(object sender, EventArgs e) {

            OnCancel(e);

        }

    }

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ken Gunderman
Top achievements
Rank 1
 answered on 23 Feb 2010
1 answer
95 views
Hello,
I'm trying to use your Ajax product with WCF Webservice, I've crated a webmethod :

    [OperationContract] 
        public RadComboBoxData GetGruppi(RadComboBoxContext context) 
        { 
            RadComboBoxData result = new RadComboBoxData(); 
 
            DataSet ds = dataAccess.GetListaGruppi(); 
 
            if (ds != null && ds.Tables[0].Rows.Count > 0) 
            { 
                List<RadComboBoxItemData> lst = new List<RadComboBoxItemData>(); 
 
                foreach (DataRow dr in ds.Tables[0].Rows) 
                { 
                    RadComboBoxItemData item = new RadComboBoxItemData(); 
 
                    item.Text = GetCheckedString(dr[2]); 
                   // item.Value = string.Format("{0}-{1}", Convert.ToInt32(dr[0]), Convert.ToInt32(dr[1])); 
                    item.Value = GetCheckedString(dr[0]); 
                    lst.Add(item); 
 
                } 
 
                
                result.Items = lst.ToArray(); 
            } 
 
 
            return result; 
        } 

and attached from ajax the WebServiceSetting :

 <WebServiceSettings Method="GetGruppi" Path="../WS/IFManagement.svc" /> 


but each time I try to use it I got this error :

Microsoft JScript runtime error: 'length' is null or not an object

The WS method is executed (I see the data in the result (via Vs2008) but when it should bind to the combobox got that exception...
any suggestion??
Thanks in advance
Paolo
Simon
Telerik team
 answered on 23 Feb 2010
4 answers
131 views
I am trying to dynamically load a usercontrol in the edit formtemplate of a grid, I only want a part of the template to change. I do that in the grids OnItemCreated event, So far so good. The usercontrol shows and I am able to enter the desired data.

Problem begins when I try to get hold of the usercontrol to actually save the data.

On clicking the update/save button of the formtemplate i want to connect to the usercontrol, get and save the content to the database.

I have tried numerous events and methods found in the forum, but i can't get hold of the control. I suspect this has to do with me adding the control dynamically, and closing the formtemplate results in a postback.

What is the best approach for this kind of scenario.

//Per Löfstedt
Jan Balas
Top achievements
Rank 1
 answered on 23 Feb 2010
5 answers
415 views
How can I configure my RadDatePicker to only allow me to pick the first of each month?
Chris Marisic
Top achievements
Rank 1
 answered on 23 Feb 2010
2 answers
202 views
Hi, I have the following radgrid:

 <telerik:RadAjaxPanel ID="MyPanel" runat="server">
        <telerik:RadInputManager ID="MyRadManager" runat="server">
                <telerik:RegExpTextBoxSetting BehaviorID="RegExpBehavior1" InitializeOnClient="false"
                    ErrorMessage="Invalid date format" InvalidCssClass="invalid"
                    ValidationExpression="((0[1-9]|1[012])[- /.](19|20)\d\d)">
                    <Validation IsRequired="true" />
                </telerik:RegExpTextBoxSetting>
            </telerik:RadInputManager>
            <telerik:RadGrid
                            ID="myGrid"
                            DataSourceID="MyDataSource"
                            runat="server"
                            AutoGenerateColumns="False"
                            GridLines="None"
                            AllowAutomaticDeletes="True"
                            AllowAutomaticInserts="True"
                            Skin="Outlook"
                            OnItemCreated="myGrid_ItemCreated"
                            OnItemCommand="myGrid_ItemCommand">
                    <HeaderContextMenu EnableTheming="True">
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                    </HeaderContextMenu>

                    <MasterTableView CommandItemDisplay="Top" DataKeyNames ="Id" DataSourceID="DegreesDataSource">
                       <CommandItemTemplate>
                                            
                                          <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !myGrid.MasterTableView.IsItemInserted %>'>
                                                <%--<img style="border:0px" alt="" src="../../DataEditing/Img/AddRecord.gif" />--%> Add New Record</asp:LinkButton>
                                            <br />
                                        </CommandItemTemplate>
                    <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>

                    <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn DataField="Title" HeaderText="Title"
                                SortExpression="Title" >
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Area"
                                HeaderText="Subject Matter or Speciality Field" SortExpression="Area">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Company" SortExpression="CompanyName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Year" HeaderText="Date" SortExpression="Year">
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn UniqueName="Delete" ButtonType="LinkButton" CommandName="Delete" Text="Remove"></telerik:GridButtonColumn>
                        </Columns>
                         <EditFormSettings EditFormType="Template">
                                            <EditColumn UniqueName="EditCommandColumn1">
                                            </EditColumn>
                                            <FormTemplate>
                                                <table cellspacing="2" cellpadding="1" width="100%" border="0">
                                                    <tr>
                                                    <td>
                                                        Degree:</td>
                                                    <td>
                                                        <asp:TextBox Width="200px" ID="TextBox1" runat="server" Text='<%# Bind("Title") %>' MaxLength="50"></asp:TextBox>
                                                        <asp:requiredfieldvalidator id="ReqTextBox1" runat="server" ErrorMessage="*" EnableClientScript="False"
                                                                                    ControlToValidate="TextBox1" Display="Static" />
                                                    </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Area:
                                                        </td>
                                                        <td>
                                                            <asp:TextBox Width="200px" ID="TextBox2" runat="server" Text='<%#Bind("Area") %>' MaxLength="200"></asp:TextBox>
                                                            <asp:requiredfieldvalidator id="ReqTextBox2" runat="server" ErrorMessage="*" EnableClientScript="False"
                                                                                    ControlToValidate="TextBox2" Display="Static"  />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Institution:
                                                        </td>
                                                        <td>
                                                            <asp:TextBox Width="200px" ID="TextBox5" runat="server" Text='<%#Bind("CompanyName") %>' MaxLength="200"></asp:TextBox>
                                                            <asp:requiredfieldvalidator
                                                                                       id="ReqTextBox5"
                                                                                       runat="server"
                                                                                       ErrorMessage="*"
                                                                                       EnableClientScript="False"
                                                                                       ControlToValidate="TextBox5"
                                                                                       Display="Static"  />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Date:</td>
                                                        <td>
                                                            <asp:TextBox Width="200px" ID="TextBox4" runat="server" Text='<%#Bind("Year") %>'/>                                                         
                                                        </td>
                                                            
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="ErrorMessage" runat="server"  EnableViewState="false" Visible="false" Text="Entry already exists." ForeColor="Red" />
                                                            <br></br>
                                                            <asp:LinkButton
                                                                            ID="Button1"
                                                                            runat="server"
                                                                            Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Update" %>'
                                                                            CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' />
                                                            <asp:LinkButton
                                                                           ID="Button2"
                                                                           runat="server"
                                                                           Text="Cancel"
                                                                           CausesValidation="false"
                                                                           CommandName="Cancel" />
                        
                                                        </td>
                                                    </tr>
                                                </table>
                                            </FormTemplate>
                                        </EditFormSettings>
                    </MasterTableView>                  
                    <FilterMenu EnableTheming="True">
                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                    </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>


<pp:ObjectContainerDataSource ID="MyDataSource" runat="server"                          
        DataObjectTypeName = "MVPWithCWABQuickStart.HelloWorld.BusinessEntities.MyEntity"
        oninserted="MyDataSource_Inserted"
        ondeleted="MyDataSource_Deleted" />

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Code-behind

 protected void MyDataSource_Inserted(object sender, Microsoft.Practices.Web.UI.WebControls.ObjectContainerDataSourceStatusEventArgs e)
        {
         
        }
        protected void MyDataSource_Deleted(object sender, Microsoft.Practices.Web.UI.WebControls.ObjectContainerDataSourceStatusEventArgs e)
        {
         
        }


 protected void myGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditFormItem editedItem = e.Item as GridEditFormItem;

                TextBox txt1 = editedItem.FindControl("TextBox4") as TextBox;
               if (txt1 != null)
                {
                    RegExpTextBoxSetting regExpSetting = (RegExpTextBoxSetting)RadDegreesManager.GetSettingByBehaviorID("RegExpBehavior1");
                    regExpSetting.TargetControls.Add(new TargetInput(txt1.UniqueID, true));
                }
            }

            if (e.Item is GridDataItem && !e.Item.IsInEditMode && e.Item.DataItem != null) //Checks that the item is a GridDataItem, is not in Edit mode and is not NULL
            {
                DateTime datetime;
                if (DateTime.TryParse(((ProfileDegree)e.Item.DataItem).Year, out datetime))
                {
                    ((ProfileDegree)e.Item.DataItem).Year = String.Format("{0:MMM/yyyy}", datetime); //Change the format of the date to MMM/yyyy (e.g. Jan/2010)
                }
            }
        }



 protected void myGrid_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
            {
                e.Canceled = true;
                var newValues = new System.Collections.Specialized.ListDictionary();
                newValues["Title"] = string.Empty;
                newValues["Area"] = string.Empty;
                newValues["CompanyName"] = string.Empty;
                newValues["Year"] = string.Empty;
                //Insert the item and rebind
                e.Item.OwnerTableView.InsertItem(newValues);
            }
            if (e.Item.ItemType == GridItemType.EditFormItem)
            {
                if (e.CommandName == "PerformInsert")
                {
                    TextBox titleTextBox = (TextBox)e.Item.FindControl("TextBox1");
                    TextBox areaTextBox = (TextBox)e.Item.FindControl("TextBox2");
                    TextBox companyTextBox = (TextBox)e.Item.FindControl("TextBox5");
                    TextBox yearTextBox = (TextBox)e.Item.FindControl("TextBox4");
                    Label errorMessage = (Label)e.Item.FindControl("ErrorMessage");

                    if (titleTextBox != null && areaTextBox != null && companyTextBox != null && yearTextBox != null)
                    {
                        //If the addition operation was not triggered from a refresh, do the database insert.
                        e.Canceled = expertiseDateValidationCancel(yearTextBox, degreeErrorMessage);
                        if (!e.Canceled)
                        {
                            MyEntity metaData = new MyEntity();
                            metaData.Degree = titleTextBox.Text;
                            metaData.Area = areaTextBox.Text;
                            metaData.InstitutionName = companyTextBox.Text;
                            metaData.Year = yearTextBox.Text;
                    

                           if(InsertObject(metaData))
                            {
                                errorMessage.Visible = true;
                                e.Canceled = true;
                            }
                          
                        }
                    }
                    else
                        errorMessage.Visible = true;
                }
            }
        }



My problem is that the required field validators in the edit form of the grid are not being fired or at least the validation do not stop the postback of the command, because I can see that Page.IsValid property is false when debugging myGrid_ItemCommand. Do you have an idea of what could be happening. my understanding is that there should not be a postback when the form is empty. I have tried using validation groups, removing the radPanel and the RadInputManager but still no luck. I know that I could stop the execution of the command using something like this:

if(!Page.IsValid)
{
 e.Cencled = true;
return;
}

but I want to avoid the post back.

I'm using RadControls for ASPNET AJAX Q1 2009 (2009.1.527.35)

Thank you for your help!!!
Gerardo Perez
Top achievements
Rank 1
 answered on 23 Feb 2010
3 answers
497 views
I am having difficulty working with the pie chart and getting the actual pie slices to render effectively.

Can you change the scale of a pie chart?  The problem that I am having is when I have a single value that encompasses 90% of the chart, the other pie slices and their labels are overlapping.

I've already tried setting Intelligent labels, setting margins on the textblocks, etc.  The labels are multi-line too.  I've set the maxlength to 50.

If you create a pie chart with the following values, you will see what I mean:

chartSeries.AddItem(30670.80,

"Infrastructure \n30,670");

 

chartSeries.AddItem(776.30,

"Energy \n$776");

 

chartSeries.AddItem(295.30,

"Education and Training \n$295");

 

chartSeries.AddItem(378021.30,

"Protecting the Vulnerable \n$378,021");

 

chartSeries.AddItem(50.00,

"Other \n$50");

I am at a loss on what else to change in order to get the labels to stop overlapping each other or get the smaller percentage pie slices to show better or bigger.

Any assistance would be greatly appricated.

Thanks,
Dawn

 

Schlurk
Top achievements
Rank 2
 answered on 23 Feb 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?