Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
153 views
I'm going to try to briefly describe the situation because the setup is a bit complicated

I have a RadGrid with popup form insert/edit.
When the popup form appears, the first object is a combobox that contains the Report ID.
The ItemDataBound event for the grid populates the popup form with the correct Report Options by building the controls and adding them to a Panel container. The Report Options are determined by the combobox that contains the Report ID

For example...if the Report ID is 1, the ItemDataBound event generates 2 comboboxes for Report Date and Report Format. Report Date has 4 options and Report Format has 2 options.

Now...the combobox for the Report ID is set to autopostback and there is a OnSelectedIndexChanged event that reruns the code that creates the Report Option controls.

For example...if I change the combobox so that the Report ID is 2, the ItemDataBound event only generates 1 combobox for Report Format which is supposed to only have 2 options.

Here's where the problem occurs. All of this works perfectly, except that when I select Report ID 2, the combobox for Report Format has 4 options in it...the last 2 are completely blank.

It seems that for some reason it's remembering that the first combobox when Report ID was selected had 4 options and even though it's changing the combobox to have the right values, it still thinks there is supposed to be 4 options when in fact there are only 2.

I tried doing a combo.Items.Clear() before building the combobox, but that didn't seem to work. I also tried clearing out the controls on the Panel and that didn't work either. You can also see from the code below that each combobox is created with a unique ID based on the ID of the Option. The Report Date combobox is generated as dd_1 while the Report Format combobox is generated as dd_8.

I guess I'm looking for a way to make sure the ComboBox has the correct number of options so that the user cannot select "blank" items.

I don't know how much help this code is going to be, but here is how I'm creating the controls

protected void BuildOptions(GridEditFormItem editFormItem)
{
    RadComboBox dd_RptID = (RadComboBox)editFormItem.FindControl("dd_RptID");
 
    EISDataContext db = new EISDataContext();
 
    // get the unique report options for the current selected report so we can render the correct controls
    var q_options = (from options in db.tReportConfigs
                     where options.RptID == dd_RptID.SelectedItem.Value
                     select options.OptID).Distinct();
 
    foreach (var option in q_options)
    {
        string optionType = (from options in db.tReportOptions
                             where options.OptID == option
                             select options.OptTyp).FirstOrDefault();
        string optionName = (from options in db.tReportOptions
                             where options.OptID == option
                             select options.OptNm).FirstOrDefault();
 
        // get the option values for this option
        var q_optionValues = from optionvalues in db.tReportConfigs
                             where optionvalues.RptID == dd_RptID.SelectedItem.Value && optionvalues.OptID == option
                             select optionvalues;
 
        // create a div for the option control and populate it with the correct control
        Panel panelContent = new Panel();
        panelContent.Attributes.Add("class", "popupcontent");
 
        if (optionType == "ComboBox")
        {
            RadComboBox combo = new RadComboBox();
            combo.ID = "dd_" + option.ToString();
            foreach (var optionValue in q_optionValues)
            {
                combo.Items.Add(new RadComboBoxItem(optionValue.tReportOptionValue.OptNm, optionValue.tReportOptionValue.OptVal));
            }
 
            panelContent.Controls.Add(combo);
        }
 
        // create a div for the option title and populate it with the option name
        Panel panelTitle = new Panel();
        panelTitle.Attributes.Add("class", "popuptitle");
        Label pnlLabel = new Label();
        pnlLabel.Text = optionName;
        panelTitle.Controls.Add(pnlLabel);
 
        // create a div for the clear control
        Panel panelClear = new Panel();
        panelClear.Attributes.Add("class", "clear");
 
        editFormItem.FindControl("divOptions").Controls.Add(panelTitle);
        editFormItem.FindControl("divOptions").Controls.Add(panelContent);
        editFormItem.FindControl("divOptions").Controls.Add(panelClear);
    }
}

Any suggestions you can provide are greatly appreciated...thanks.
Dimitar Terziev
Telerik team
 answered on 18 Apr 2011
1 answer
117 views
Hello,

I am working with Rad WYSWYG editor here i can see editor i can type text make it bols ,align it etc but when i start adding link or making a text as hyperlink for that when i click on Isert Link Icon one widow gets pop by saying Web.config registration missing ! the telerik dialog require HttpHandler registration in web.config file. I am not getting wht this is happning i even added DialogHandlerUrl="~/Telerik.Web.UI.DialogHandler.axd" property but still not able to add link.

I had attached a screen shot here with please review and recommmend.

I am using Licencesed version of Telerik.

Please suggest any suggesion on this i require to use this Editor.

Thanks,
Dobromir
Telerik team
 answered on 18 Apr 2011
2 answers
61 views
Hello,

I have been working on an application which uses the rad scheduler.  It is an asp.net application and the scheduler is using webservices to communicate with the server without the need for page postbacks.  I have replaced the edit and insert forms using a radwindow, and displayed the windows using the OnClientAppointmentEdit and OnClientAppointmentInsert events (then cancelled the default behaviour).

For the most part, it is performing beautifully and as expected.

There is a strange problem when the user gets a bit 'click happy' with the scheduler, the mouse coords seem to be offset.  For example, when the scheduler goes into this state, I can no longer drag or resize the appointments.  If I move the mouse down below the appointment, I can drag it.

I was wondering if this is a known issue and if so, is there a fix for it?  I can post more information on my project if needed.

Best Regards,
Michael
Peter
Telerik team
 answered on 18 Apr 2011
2 answers
170 views
Hello All,

The situation:

We have a project in Visual Studio 2010 (with TFS) that is using the Telerik.Web.UI.dll.

The problem:

Whenever any one of the developers builds and runs the project, the Telerik dll's are automatically checked out and locked for that developer.  This makes the other developers unable to run the project until it's checked back in.

The question:

Is there something about the Telerik software that requires this, or is it completely unrelated to Telerik and merely a VS configuration problem? 

The gratitude:

Thanks, in advance.


Glenn
Glenn
Top achievements
Rank 1
 answered on 18 Apr 2011
1 answer
60 views
Hi, I have a problem about RadGrid.
I put two RadDatePricers in RadGrid . When the RadGrid first show up , some contents showed in the RadGrid will show up outside the bottom border of the RadGrid,  after two seconds , the contents showed outside the bottom disappear automatically and everything is ok.
Is there any way to resolve the problem?

aspx:
       <telerik:RadGrid ID="RadGrid_ProjectEvaluationStep" runat="server"   AutoGenerateColumns="False"
                DataSourceID="ObjectDataSource_ProjectEvaluationStep" GridLines="None" Height="285px" Width="500px"
                onitemdatabound="RadGrid_ProjectEvaluationStep_ItemDataBound">                
                <MasterTableView DataSourceID="ObjectDataSource_ProjectEvaluationStep">
                    <Columns>
                        <telerik:GridBoundColumn DataField="EvaluationStepID" UniqueName="EvaluationStepID" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="EvaluationStep" HeaderText="" UniqueName="EvaluationStep">
                            <HeaderStyle Width="150px"/>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ProcedureStepID" UniqueName="ProcedureStepID" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PlanBeginDate" UniqueName="PlanBeginDate" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PlanEndDate" UniqueName="PlanEndDate" Visible="False">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn Resizable="False" HeaderText="" >
                            <ItemTemplate>
                                <telerik:RadDatePicker ID="RadDatePicker_Begin" runat="server">
                                    <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
                                    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                                    <DateInput DisplayDateFormat="yyyy-MM-dd" DateFormat="yyyy-MM-dd"></DateInput>
                                </telerik:RadDatePicker>
                            </ItemTemplate>
                            <HeaderStyle Width="140px"/>                                
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn Resizable="False" HeaderText="" >
                            <ItemTemplate>
                                <telerik:RadDatePicker ID="RadDatePicker_End" runat="server">
                                    <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
                                    <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
                                    <DateInput DisplayDateFormat="yyyy-MM-dd" DateFormat="yyyy-MM-dd"></DateInput>
                                </telerik:RadDatePicker>
                            </ItemTemplate>
                            <HeaderStyle Width="140px"/>                                
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="True" UseStaticHeaders="True"/>
                </ClientSettings>
            </telerik:RadGrid>

c#
protected void RadGrid_ProjectEvaluationStep_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            RadDatePicker beginDate = (RadDatePicker)e.Item.Cells[7].FindControl("RadDatePicker_Begin");
            RadDatePicker endDate = (RadDatePicker)e.Item.Cells[8].FindControl("RadDatePicker_End");

            if (e.Item.Cells[5].Text == null || e.Item.Cells[5].Text == "&nbsp;")
            {
                beginDate.SelectedDate = null;
            }
            else
            {
                beginDate.SelectedDate = Convert.ToDateTime(e.Item.Cells[5].Text);

                if (e.Item.Cells[4].Text == "1")
                {
                    beginDate.Enabled = false;
                }
            }

            if (e.Item.Cells[6].Text == null || e.Item.Cells[6].Text == "&nbsp;")
            {
                endDate.SelectedDate = null;
            }
            else
            {
                endDate.SelectedDate = Convert.ToDateTime(e.Item.Cells[6].Text);
            }                       
        }
    }
Iana Tsolova
Telerik team
 answered on 18 Apr 2011
3 answers
163 views
Hello,

I have a RadTreeView control in my application that can potentially contain a large number of nodes.  When it does contain a large number of nodes, I get the error:

"Error during serialization or deserialization using the JSON JavaScriptSerializer.  The length of the string exceeds the value set on the maxJsonLength property."

Normally, I would increase the maxJsonLength value in my web.config, however my application is being installed into SharePoint Central Administration as a feature, and I cannot modify maxJsonLength in Central Admin's web.config for a variety of reasons.

I would like to disable AJAX completely so that JSON serialization is not used - it's okay if the control takes a while to load, plus I am limiting the user to merely expanding and selecting nodes.  Is this possible?

Thanks,
Leigh

The treeview definition (nodes are added in code during page load):

<telerik:radtreeview id="ScopeTreeView" runat="server" checkboxes="false" multipleselect="false"
                    allownodeediting="false" registerwithscriptmanager="false" visible="true" />
Veronica
Telerik team
 answered on 18 Apr 2011
2 answers
141 views
while accessing the addnew control insert button in my rad grid. my grid disappears. I don't know how to fix this prob. If any body knows pls let me know. This is my snippet:



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Models.aspx.cs" Inherits="TBS_HelpDesk.Views.Assets.Models"
    MasterPageFile="~/Views/Shared/MasterPage.Master" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
    <div style="width: 500px; height: 600px;">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox1" UpdatePanelHeight="" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox1" UpdatePanelHeight="" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelHeight="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadComboBox ID="RadComboBox1" runat="server" Width="200" AutoPostBack="true"
            AppendDataBoundItems="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
        </telerik:RadComboBox>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
            GridLines="None" AllowPaging="True" AllowSorting="True" Skin="Office2007" OnItemCommand="RadGrid1_ItemCommand"
            AutoGenerateColumns="False" >
            <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" EnableHeaderContextMenu="true">
                <PagerStyle BackColor="#D8EBFC" />
                <HeaderStyle CssClass="dataheadcolor" />
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                    <telerik:GridNumericColumn DataField="Model_ID" HeaderText="Model Id" SortExpression="Model_ID"
                        UniqueName="Model_ID">
                    </telerik:GridNumericColumn>
                    <telerik:GridBoundColumn DataField="Model_Name" HeaderText="Model Name" SortExpression="Model_Name"
                        UniqueName="Model_Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Model_Description" DataType="System.Boolean"
                        HeaderText="Model Description" SortExpression="Model_Description" UniqueName="Model_Description">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
                        CommandArgument="Child" ConfirmDialogType="RadWindow" ConfirmText="Are You Sure Want To Delete This Record?"
                        ConfirmTitle="Delete Confirm" />
                </Columns>
                <EditFormSettings ColumnNumber="3" CaptionFormatString="Model Create">
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                    <FormTemplate>
                        <table cellspacing="2" cellpadding="1" width="100%" border="1">
                            <tr>
                                <td>
                                    <asp:Label runat="server" Text="Manuf" ID="label1"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox Width="200px" ID="Model_ID" AutoCompleteType="Disabled" runat="server"
                                        Text='<%# Bind("Model_ID") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Model Name
                                </td>
                                <td>
                                    <asp:TextBox Width="200px" ID="Model_Name" AutoCompleteType="Disabled" runat="server"
                                        Text='<%# Bind("Model_Name") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Model Description
                                </td>
                                <td>
                                    <asp:TextBox Width="200px" ID="Model_Description" AutoCompleteType="Disabled" runat="server"
                                        Text='<%# Bind("Model_Description") %>'></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="Button1" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button>
                                    <asp:Button ID="Button2" runat="server" Text="Cancel" CausesValidation="false" CommandName="Cancel">
                                    </asp:Button>
                                </td>
                            </tr>
                        </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
</asp:Content>











using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;

namespace TBS_HelpDesk.Views.Assets
{
    public partial class Models : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadManufacturers();
            }
        }
        protected void LoadManufacturers()
        {
            DataTable dtTable = new DataTable();
            string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
            SqlDataAdapter sqladp = new SqlDataAdapter();
            SqlConnection sqlconn = new SqlConnection(conn);
            sqlconn.Open();

            try
            {
                string selectQuery = "SELECT * FROM [ASSETMANUFACTURERS] order by Manuf_ID asc";
                sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
                sqladp.Fill(dtTable);

                RadComboBox1.DataValueField = "Manuf_ID";
                RadComboBox1.DataTextField = "Manuf_Name";
                RadComboBox1.DataSource = dtTable;
                RadComboBox1.DataBind();
                RadComboBox1.Items.Insert(0, new RadComboBoxItem("- Select Manufacturers Name -"));

            }
            finally
            {
                sqlconn.Close();
            }
        }
        protected void LoadModels(string Manuf_ID)
        {
            SqlConnection connection = new SqlConnection(
      ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);

            SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_Manuf_ID", connection);
            adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", RadComboBox1.SelectedValue);
            DataTable dt = new DataTable();
            adapter.Fill(dt);
            RadGrid1.DataSource = dt;
            RadGrid1.DataBind();
        }

        protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            LoadModels(e.Text);
        }
        //protected void RadGrid1_RowDataBound1(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        e.Row.Attributes.Add("id", e.Row.RowIndex.ToString());
        //        e.Row.Attributes.Add("onclick", "MarkRow(" + e.Row.RowIndex.ToString() + ");");
        //    }
        //}
        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {

            SqlConnection connection = new SqlConnection(
      ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ConnectionString);

            DataTable dtTable = new DataTable();
            string conn = ConfigurationManager.ConnectionStrings["TBSHelpDeskLiveDB_ConnectionString"].ToString();
            SqlDataAdapter sqladp = new SqlDataAdapter();
            SqlConnection sqlconn = new SqlConnection(conn);
            SqlCommand sqlcmd = new SqlCommand();

            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;

                RadNumericTextBox Model_ID = (e.Item as GridEditFormInsertItem)["Model_ID"].Controls[0] as RadNumericTextBox;
                TextBox Model_Name = (e.Item as GridEditFormInsertItem)["Model_Name"].Controls[0] as TextBox;
                TextBox Model_Description = (e.Item as GridEditFormInsertItem)["Model_Description"].Controls[0] as TextBox;


                try
                {
                    sqlconn.Open();
                    string insertQuery = "INSERT INTO [AssetModels] ([Model_Manuf_ID],[Model_ID],[Model_Name], [Model_Description]) VALUES ('" + RadComboBox1.SelectedValue + "','" + Model_ID.Text + "','" + Model_Name.Text + "','" + Model_Description.Text + "')";
                    sqlcmd.CommandText = insertQuery;
                    sqlcmd.Connection = sqlconn;
                    sqlcmd.ExecuteNonQuery();

                    SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_ID", connection);
                    adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", RadComboBox1.SelectedValue);
                    DataTable dt = new DataTable();
                    adapter.Fill(dt);
                    RadGrid1.DataSource = dt;
                    RadGrid1.DataBind();
                }
                catch (Exception ex)
                {
                    RadGrid1.Controls.Add(new LiteralControl("Unable to insert Employee. Reason: " + ex.Message));
                }
                RadGrid1.MasterTableView.IsItemInserted = false;
                RadGrid1.DataBind();
                e.Canceled = true;
            }
            else if (e.CommandName == RadGrid.UpdateCommandName)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;

                RadNumericTextBox Model_ID = (e.Item as GridEditableItem)["Model_ID"].Controls[0] as RadNumericTextBox;
                TextBox Model_Name = (e.Item as GridEditableItem)["Model_Name"].Controls[0] as TextBox;
                TextBox Model_Description = (e.Item as GridEditableItem)["Model_Description"].Controls[0] as TextBox;

                try
                {
                    sqlconn.Open();
                    string updateQuery = "UPDATE [AssetModels] SET [Model_Name] = '" + Model_Name.Text + "', [Model_Description] = '" + Model_Description.Text + "' WHERE [Model_ID] = '" + Model_ID.Text + "'";
                    sqlcmd.CommandText = updateQuery;
                    sqlcmd.Connection = sqlconn;
                    sqlcmd.ExecuteNonQuery();
                    SqlDataAdapter adapter = new SqlDataAdapter("SELECT Model_ID,Model_Name,Model_Description FROM AssetModels WHERE Model_Manuf_ID=@Manuf_ID ORDER By Model_ID", connection);
                    adapter.SelectCommand.Parameters.AddWithValue("@Manuf_ID", RadComboBox1.SelectedValue);
                    DataTable dt = new DataTable();
                    adapter.Fill(dt);
                    RadGrid1.DataSource = dt;
                    RadGrid1.DataBind();
                    sqlconn.Close();
                }
                catch (Exception ex)
                {
                    RadGrid1.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));

                }
                RadGrid1.EditIndexes.Clear();
                RadGrid1.DataBind();
                e.Canceled = true;
            }
            else if (e.CommandName == RadGrid.DeleteCommandName)
            {
                GridDataItem item = (GridDataItem)e.Item;
                string Model_Manuf_ID = item["Model_Manuf_ID"].Text;

                try
                {
                    sqlconn.Open();
                    string deleteQuery = "DELETE FROM [AssetModels] WHERE [Model_Manuf_ID] ='" + Model_Manuf_ID + "'";
                    sqlcmd.CommandText = deleteQuery;
                    sqlcmd.Connection = sqlconn;
                    sqlcmd.ExecuteNonQuery();
                    string selectQuery = "SELECT Model_Manuf_ID, Manuf_Name, Manuf_Description, Manuf_Inactive FROM [AssetModels] order by Model_Manuf_ID asc";
                    sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn);
                    sqladp.Fill(dtTable);
                    RadGrid1.DataSource = dtTable;
                    sqlconn.Close();
                }
                catch (Exception ex)
                {
                    RadGrid1.Controls.Add(new LiteralControl("Unable to delete Id. Reason: " + ex.Message));
                    e.Canceled = true;
                }

            }
        }
    }
}
mohamed
Top achievements
Rank 1
 answered on 18 Apr 2011
4 answers
106 views
I'm trying to use the RadFilter to work around the following limitation:

"RadGrid's filtering does not support "Between" FilterFunction when the RadGrid is bound to the EntityDataSource."

What I need is a Filter showing only one field (Date) that appears on startup. Much of the Filter UI should be hidden, including the TimePickers. I've attached a picture of what the desired result.

Any ideas how I can build a stripdown version of the RadFilter like this?

Thanks,

Ken
Microsoft MVP [ASP.NET]
ASPInsider
Iana Tsolova
Telerik team
 answered on 18 Apr 2011
3 answers
241 views
Hi,
I've created a custom module with a RadGrid in the backed to manage the module's items. I have a LinkButton inside a RadGrid GridTemplateColumn which I use to send a PDF document from a database to the user. I ran into the issue described in this thread:
http://www.telerik.com/community/forums/aspnet/ajax/radgrid-response-binarywrite-asp-net-ajax.aspx
I used the solution suggested in that thread adding an event like this one to the grid page:

protected void RadGrid1_ItemCreated(object sender, Telerik.WebControls.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            Button btn = (e.Item as GridDataItem)["TemplateColumn"].FindControl("Button1") as Button;
            ScriptManager1.RegisterPostBackControl(btn);
        }
        if (e.Item is GridCommandItem)
        {
            Button btncmd = (e.Item as GridCommandItem).FindControl("Button2") as Button;
            ScriptManager1.RegisterPostBackControl(btncmd);
        }
    }

This seemed to fix the problem, but then I noticed if I make the grid sortable and I click on a column header to sort the items, then I click on any item's LinkButton, I get again the Sys.WebForms.PageRequestManagerParserErrorException. Same happens if I enable grouping and group the items by any column.

This is the LinkButton codebehind:

protected void ItemsGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Guid candidaturaId = new Guid(ItemsGrid.MasterTableView.DataKeyValues[e.Item.ItemIndex]["ID"].ToString());
 
        // create a new instance of ContactsManager with default provider
        CandidatureManager cm = new CandidatureManager();
 
        // get the desired candidatura and set the values of the form
        ICandidatura candidatura = cm.GetCandidatura(candidaturaId);
 
            string ext = Path.GetExtension(candidatura.AllegatoFilename).ToLower();
            CustomDownload cd =
                new CustomDownload
                {
                    Filename = candidatura.AllegatoFilename,
                    MimeType = (ext == ".pdf") ? MediaTypeNames.Application.Pdf : "application/unknown",
                    Data = candidatura.Allegato.ToArray(),
                };
 
            ScriptManager sm = (ScriptManager)Page.FindControl("TheScriptManager");
 
            Response.ClearHeaders();
            Response.ClearContent();
            Response.AddHeader("Accept-Ranges", cd.Data.Length.ToString());
            Response.AddHeader("Content-Disposition", "attachment;filename=" + cd.Filename);
            Response.ContentType = cd.MimeType;
            if (cd.Data.Length > 0)
                Response.BinaryWrite(cd.Data);
            Response.End();
        }
    }


Thank you,
Alessio Scalerandi
Iana Tsolova
Telerik team
 answered on 18 Apr 2011
1 answer
46 views

Hi All,

Please go through the below link in Firefox 4.
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/headercontextmenu/defaultcs.aspx
When I Show/Hide the columns using Context Menu it is not auto - adjusting the width of the grid. It leaves an empty space
at the right hand side.Though it is working fine in IE(Internet Explorer) and lower versions of Firefox.
Can you please suggest how to get rid of this space so that it auto-adjusts itself.
Expecting for an early reply.

Thanks,
Amrita Mandal

Tsvetina
Telerik team
 answered on 18 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?