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

I am using telrik grid having 'EnableHeaderContextFilterMenu' enabled. I want to customize header context filter menu in order to add custom combo box instead of text box in filter menu  option. I am using 'GridTemplateColumn' having rad combo box in 'FilterTemplate' as mentioned below:-

<telerik:GridTemplateColumn DataField="UserType" InitializeTemplatesFirst="false"
                                    HeaderText="User Type" HeaderStyle-Width="100px" UniqueName="UserType" SortExpression="UserType"
                                    AllowFiltering="true" AutoPostBackOnFilter="true" FilterControlWidth="80px">
                                    <HeaderTemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:LinkButton ID="lnkSort2" runat="server" CommandArgument="UserType" CommandName="Sort"
                                                        Text="User Type"></asp:LinkButton>
                                                </td>
                                                <td>
                                                    <img src="App_Themes/Default/img/fillter_icon.png" style="vertical-align: middle;
                                                        margin-left: 5px; cursor: pointer" onclick='ShowColumnHeaderMenu(event,"UserType")'
                                                        alt="Show context menu" />
                                                </td>
                                            </tr>
                                        </table>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblUserType" runat="server" Text='<%# Eval("UserType")%>'></asp:Label>
                                    </ItemTemplate>
                                    <FilterTemplate>
                                        <telerik:RadComboBox runat="server" ID="radCmbUserType" DataValueField="UserType"
                                            AutoPostBack="true" DataTextField="UserType" Width="90px">
                                        </telerik:RadComboBox>
                                    </FilterTemplate>
                                </telerik:GridTemplateColumn>

Below is the function which binds rad combo box with the values:-

private void LoadFilterCombo()
        {
            if (null != grdAccounts && grdAccounts.MasterTableView.GetItems(GridItemType.Item).Count() > 0)
            {
                RadComboBox cboUserType = ((RadComboBox)((GridFilteringItem)grdAccounts.MasterTableView.GetItems(GridItemType.FilteringItem)[0])["UserType"].FindControl("radCmbUserType"));           

                foreach (int index in Enum.GetValues(typeof(CampaignService.UserType)))
                {
                    RadComboBoxItem item = new RadComboBoxItem();
                    item.Value = index.ToString();
                    item.Text = Enum.GetName(typeof(CampaignService.UserType), index);
                    cboUserType.Items.Add(item);
                }

            }
        }

I want this rad combo box to be displayed in 'HeaderContextFilter Menus' instead of default textbox as shown in attached image in order to apply filter as per selected values in combo box.

can you please suggest any solution on this?

Thanks and Regards,
Deepti



Pavlina
Telerik team
 answered on 27 Jun 2012
1 answer
245 views
Hello.
I have a MasterPage setup in a Web Application.
Based on different button clicks i load dynamically different usercontrols in a contentplaceholder.

ContentPlaceHolder cph = this.FindControl("ContentPlaceHolder1") as ContentPlaceHolder;
      UserControl uc = this.LoadControl("~/UserControls/" + strName + ".ascx") as UserControl;
 
      if ((cph != null) && (uc != null))
      {
          uc.ID = strName;
          cph.Controls.Clear();
          cph.Controls.Add(uc);
          IsControlAdded = true;
          ViewState[IDS_USERCONTROL] = strName;
      }

The problem is that i need in Site.Master to use some js code that exists in a dynamically loaded usercontrol.
That seems to be no problem for the first loaded usercontrol because the usercontrols html is included in the master page html.
The problem arrises when i dynimically load the second usercontrol i find out that the html and js from the first usercontrol loaded persists in the master page and the second usercontrol's js and html is not loaded.

If i add EnableAJAX="false" to the radajaxmanager it solves my problem .. but then again .. that beats the purpose of using ajaxmanager.
 
switch (index) {
 case 0: //Person
     var arr = GetSelectedPerson();                            
     args.set_cancel(true);
     break;
 case 1: //Company
     break;
 case 2: //Group
     var arr = GetSelectedGroups();
    break;

This is a code snipplet from Site.Master
GetSelectedPerson and GetSelectedGroups are two js methods that exist in different usercontrols.

Maria Ilieva
Telerik team
 answered on 27 Jun 2012
9 answers
693 views
Is there a property for the RadNumericTextBox equivalent to the "Validation-IsRequired" property of the RadInputManager control?
Maria Ilieva
Telerik team
 answered on 27 Jun 2012
3 answers
234 views
Hi,

I have country and city column in the radgrid and I have defined a template filters using radcombobox for both the columns. I am able to filter on both columns.

The only problem I have is when removing filtering.

Say I have filtered on both Country and city column and then I select All in the Country Filter column. 
In the country combo selectedindexchanged event I am clearing the filtering using the following command

filterItem.FireCommandEvent("Filter"new Pair("NoFilter""Country")); 

The problem is that the filtering on the city column is still active. So i modified the above code to this

filterItem.FireCommandEvent("Filter"new Pair("NoFilter""Country")); 
filterItem.FireCommandEvent("Filter"new Pair("NoFilter""City")); 

THe above code does not work. The FireCommandEvent works only for the first line, not for the second. I tried switching the statement order.  Is it possible to remove filtering on multiple columns by calling FireCommandEvent multiple times.

Thanks
Pavlina
Telerik team
 answered on 27 Jun 2012
3 answers
182 views
I'm using an image with a hyperlink grid column but I am unable to get the image to vertically align in the middle. It almost appears like the grid is placing the image in the column an an unbreakable space ( & nbsp ;) causing the image to be forced to the top.

Any thoughts?
Eyup
Telerik team
 answered on 27 Jun 2012
10 answers
337 views
Hello Everyone,

I have two questions about Radgrid that I never understood completely. I'm using the new telerik 2011.3.1305.40. ASP.NET AJAX.
I Send a download Link with a simple example to illustrate my doubts. http://www.omnilab.com.br/documentos/ReadOnlyFields.rar
In the example I have one table with 4 fields. One of them is the primary key and identity field.

When I run the example, all happens fine, I can Edit and Update the table, however:
  1. When I make the field "id_movie" readonly, the table no longer updates. Why this happens? How can I solve this?
  2. If I change the type of field "control" to bit (to enable checkbox), the table no longer updates. Why this happens? How can I solve this?

I appreciate anyone to clarify those doubts to me.

Regards,
Marcio Nascimento

Andrew
Top achievements
Rank 1
Veteran
Iron
 answered on 27 Jun 2012
5 answers
283 views
I'm trying to build something like a "newsletter manager" that allows the user to compose an html formatted message and then send it to mailing lists.
In a real scenario, the user would insert Images and/or other "contents" (something that's not just typed text) selecting it from its local hard drive.
Onche the content file has been selected, and the user has choosen some of its properties (i.e. height/width for an image) I would like to process this file, maybe resize/compact it, then upload to a specific website folder, and then have the url to that file inserted in the editor content.

I hoped that this was what the RadEditor ImageDialog and similar do, but it doesn't seems so.
I'm I wrong ar I'm I missing something ?

What is the preferred tecnique to achieve that goal ?

thx
Ubaldo
Rumen
Telerik team
 answered on 27 Jun 2012
0 answers
388 views
Need help here. This grid has 2 records being displayed. If I edit the first record everything works fine. If I edit the second record I get this debug message:

This only happens if I have ListDataMember="ReportName"

HttpException was unhandled by user code
DataBinding: 'System.String' does not contain a property with the name 'ReportName'

here is the item databound sub, Getting the error on ReportNameddList.Databind()
Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If (TypeOf e.Item Is GridEditableItem AndAlso CType(e.Item, GridEditableItem).IsInEditMode) Then
        Dim GridRow As GridEditableItem = e.Item
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim editMan As GridEditManager = editedItem.EditManager
 
 
        ' this covers the report format field priming
        Dim editor As GridDropDownListColumnEditor = CType(editMan.GetColumnEditor("ddReportFormat"), GridDropDownListColumnEditor)
 
        Dim ReportFormatddList As DropDownList = editor.DropDownListControl
        ReportFormatddList.Items.Insert(0, New ListItem("Excel", "Excel"))
        ReportFormatddList.Items.Insert(1, New ListItem("PDF", "PDF"))
        ReportFormatddList.Items.Insert(2, New ListItem("HTML4.0", "HTML4.0"))
        ReportFormatddList.DataBind()
 
        'select the correct record
        Dim ReportFormatString As String = GridRow.GetDataKeyValue("ReportFormat").ToString()
        ReportFormatddList.Items.FindByValue(ReportFormatString).Selected = True
 
 
 
        'this covers the report name field priming
        editor = CType(editMan.GetColumnEditor("ddReportName"), GridDropDownListColumnEditor)
        Dim ReportNameddList As DropDownList = editor.DropDownListControl
        ReportNameddList.DataSource = (From r In DbContext.SubscriptionReportNames Select r.ReportName).ToList()
        ReportNameddList.DataBind()  '<-- this is the error line, but only when second row is being edited.

 
        'select the correct record
        Dim ReportNameString As String = GridRow.GetDataKeyValue("ReportName").ToString()
        ReportNameddList.Items.FindByValue(ReportNameString).Selected = True
 
 
 
    End If
End Sub

.aspx code
  <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="False"
            AllowPaging="True" AllowSorting="True" CellSpacing="0"
        GridLines="None" ShowGroupPanel="True" Skin="Web20">
            <MasterTableView DataKeyNames="ReportFormat,ReportName,FranchiseSubscriptionEmailID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" />
 
                    <telerik:GridBoundColumn DataField="FranchiseSubscriptionEmailID"
                        HeaderText="Record ID" ReadOnly="true"
                        ForceExtractValue="Always" ConvertEmptyStringToNull="true"
                        Visible="False" />
 
                    <telerik:GridBoundColumn DataField="FranchiseeID" HeaderText="Franchisee ID"
                        Visible="False" />
 
                <telerik:GridDropDownColumn DataSourceID="ReportNameddlist" ListTextField="ReportName"
                    ListValueField="ReportName" UniqueName="ddReportName" SortExpression="ReportName"
                    HeaderText="Report Name" DropDownControlType="DropDownList" ListDataMember="ReportName"
                        DataField="ReportName">
                </telerik:GridDropDownColumn>
 
                    <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email Address" />
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Franchisee Name" />
 
                <telerik:GridDropDownColumn DataSourceID="ReportFormatddlist" ListTextField="ReportFormat"
                    ListValueField="ReportFormat" UniqueName="ddReportFormat" SortExpression="ReportFormat"
                    HeaderText="Report Format" DropDownControlType="DropDownList"
                        DataField="ReportFormat" ListDataMember="ReportFormat">
                </telerik:GridDropDownColumn>
 
                    <telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"
                       ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
 
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="ImageButton" />
                </EditFormSettings>
            </MasterTableView>
            <PagerStyle Mode="NextPrevAndNumeric" />
            <ClientSettings AllowDragToGroup="True">
                <ClientEvents OnRowDblClick="rowDblClick" />
            </ClientSettings>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
justin
Top achievements
Rank 1
 asked on 27 Jun 2012
8 answers
266 views
Something changed re: RadNumericTextBoxes in the newest version of the Telerik Rad Ajax Controls (2012.2.607.40)

Our client-side/markup validators are all now broken on any currency validation as the "$" and the "," values are being passed thru instead of the raw value.

This change just happened with this new version of the Ajax controls and we have a lot of code that is now broken in production.

Need someone at Telerik to address this ASAP.

<telerik:RadNumericTextBox ID="rntbBudget" runat="server" CssClass="TextboxAnimated" Width="150px"
    Type="Currency" DataType="Decimal" DbValue='<%# Eval("fldBudget") %>' NumberFormat-DecimalDigits="2" />
<asp:RequiredFieldValidator ID="rfvBudget" runat="server" ControlToValidate="rntbBudget"
    ErrorMessage="Must enter a Budget amount!" Text="!" CssClass="errorMessage" />
<asp:CompareValidator ID="cvBudget" runat="server" ControlToValidate="rntbBudget" ValueToCompare="0.00"
    Operator="GreaterThan" Type="Currency" ErrorMessage="The Budget amount must be greater than $0.00!" Text="!" CssClass="errorMessage" />


The above code now generates a validation error when it never did before.

Jerry



**EDIT**

Below is a workaround, for now:
<telerik:RadNumericTextBox ID="rntbBudget" runat="server" CssClass="TextboxAnimated" Width="150px"
    Type="Number" DataType="Decimal" DbValue='<%# Eval("fldBudget") %>' NumberFormat-DecimalDigits="2" NumberFormat-GroupSeparator="" />
<asp:RequiredFieldValidator ID="rfvBudget" runat="server" ControlToValidate="rntbBudget"
    ErrorMessage="Must enter a Budget amount!" Text="!" CssClass="errorMessage" />
<asp:CompareValidator ID="cvBudget" runat="server" ControlToValidate="rntbBudget" ValueToCompare="0.00"
    Operator="GreaterThan" Type="Currency" ErrorMessage="The Budget amount must be greater than $0.00!" Text="!" CssClass="errorMessage" />

Notice the changes: The Type attribute on the RadNumericTextBox had to be changed from "Currency" to "Number" and the NumberFormat-GroupSeparator attributte had to be added but set to an empty string "".

This means a LOT of our production code now needs to be modified due to this underlying change in the RadNumericTextBox control.

Why did that change? There was no mention of it in the release notes either.
Jerry T.
Top achievements
Rank 1
 answered on 27 Jun 2012
1 answer
59 views
Which Rad control should I use for a CheckBox when I'm using ASP.NET Ajax?
Bozhidar
Telerik team
 answered on 27 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?