Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
249 views

Below is code that I have for my custom filter column.  Everything works great, however, if I select
"All" from the radcombobox I get "No records to display."  I am not sure if it is set up correctly to
either remove the the currentfilterfunction and value or how I set the column to no NoFilter when
"All" is chosen.  Any ideas?  Below is the code.  Thanks is advance.

Joshua

public class MyCustomFilteringColumn : GridBoundColumn  
{  
 
    //RadGrid will call this method when it initializes the controls inside the filtering item cells  
    protected override void SetupFilterControls(TableCell cell)  
    {  
        base.SetupFilterControls(cell);  
        cell.Controls.RemoveAt(0);  
        Telerik.Web.UI.RadComboBox combo = new Telerik.Web.UI.RadComboBox();  
        combo.ID = ("RadComboBox1" + this.UniqueName);  
        combo.ShowToggleImage = false;  
        combo.Skin = "Office2007";// "Web20";  
        combo.EnableLoadOnDemand = true;  
        combo.AutoPostBack = true;  
        combo.MarkFirstMatch = true;  
        combo.Height = Unit.Pixel(100);  
        combo.Width = Unit.Pixel(60);  
        combo.ItemsRequested += this.list_ItemsRequested;  
        combo.SelectedIndexChanged += this.list_SelectedIndexChanged;  
        cell.Controls.AddAt(0, combo);  
        cell.Controls.RemoveAt(1);  
    }  
 
    //RadGrid will cal this method when the value should be set to the filtering input control(s)  
    protected override void SetCurrentFilterValueToControl(TableCell cell)  
    {  
 
        base.SetCurrentFilterValueToControl(cell);  
        RadComboBox combo = (RadComboBox)cell.Controls[0];  
 
        if ((this.CurrentFilterValue != string.Empty))  
        {  
            combo.Text = this.CurrentFilterValue;  
        }  
    }  
 
    //RadGrid will call this method when the filtering value should be extracted from the filtering input control(s)  
    protected override string GetCurrentFilterValueFromControl(TableCell cell)  
    {  
        RadComboBox combo = (RadComboBox)cell.Controls[0];  
        return combo.Text;  
    }  
 
    private void list_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)  
    {  
        ((RadComboBox)o).DataTextField = this.DataField;  
        ((RadComboBox)o).DataValueField = this.DataField;  
        ((RadComboBox)o).DataSourceID = Global.GridDS;  
        ((RadComboBox)o).DataBind();  
        ((RadComboBox)o).Items.Insert(0, new RadComboBoxItem("All", ""));  
    }  
 
    private void list_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
        GridFilteringItem filterItem = (GridFilteringItem)((RadComboBox)o).NamingContainer;  
 
        if ((this.UniqueName == "Index"))  
        {  
            //this is filtering for integer column type   
            filterItem.FireCommandEvent("Filter", new Pair("EqualTo", this.UniqueName));  
        }  
        //filtering for string column type  
        filterItem.FireCommandEvent("Filter", new Pair("Contains", this.UniqueName));  
    }  
}  
Josh
Top achievements
Rank 1
 answered on 04 Jun 2009
3 answers
123 views
hi team telerik
How Can Grid Switch to Insert Mode in Page load?
Phil
Top achievements
Rank 2
 answered on 04 Jun 2009
1 answer
191 views
Hi,

I have a Rad grid and Client side, I am trying to retrieve the value of a cell in Javascript.

I followed the following example, to try and get it to work.
http://www.telerik.com/help/aspnet-ajax/grdgettingcellvaluesforselectedrowsclientside.html

However, I get the following javascript error when selecting the grid row and trying to get the innerHTML value.
"Microsoft JScript runtime error: 'getCellByColumnUniqueName(...).innerHTML' is null or not an object"

Following is the markup for the Grid:

 

 

 
  <telerik:RadGrid ID="RadGridMapFilter"  runat="server" AllowPaging="True" AllowMultiRowSelection="True"  ClientSettings-EnablePostBackOnRowClick="false" ShowHeader="true" 
                            PagerStyle-Mode="Slider" GridLines="Horizontal"   
                            Width="377px" AutoGenerateColumns="False" Height="320px" ClientSettings-ClientEvents-OnRowSelected="RowSelected" ClientSettings-ClientEvents-OnRowClick="RowClickPeerGrid" > 
                          
                        <MasterTableView> 
                        <columns>                                                                 
                        <telerik:GridBoundColumn DataField="FilterAbb" HeaderText="Filters"   
                            SortExpression="Filters" Visible="false" /> 
                        <telerik:GridBoundColumn DataField="FilterName" HeaderText="Filters"   
                            SortExpression="Filters" Visible="true" /> 
 
                        </columns> 
                          
                            <RowIndicatorColumn Visible="False">  
                                <HeaderStyle Width="20px" /> 
                            </RowIndicatorColumn> 
                            <ExpandCollapseColumn Resizable="False" Visible="False">  
                                <HeaderStyle Width="20px" /> 
                            </ExpandCollapseColumn> 
                            <EditFormSettings> 
                                <PopUpSettings ScrollBars="None" /> 
                            </EditFormSettings> 
                        </MasterTableView> 
                        <ClientSettings> 
                            <Selecting AllowRowSelect="True" /> 
                        </ClientSettings> 
                    </telerik:RadGrid> 
 


and following are the two javascript functions:

 

function RowSelected(sender, eventArgs)  
 {  
   var dataItem = $get(eventArgs.get_id());  
   var grid = sender;  
   var MasterTable = grid.get_masterTableView();  
   var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];  
   var cell = MasterTable.getCellByColumnUniqueName(row, "FilterAbb").innerHTML;;    
   //var strRowValue = cellinnerHTML;  
  //here cell.innerHTML holds the value of the cell    
   alert(cell);    
 }  
 
function GetSelectedNames()  
 {  
   var grid = $find("<%=RadGridMapFilter.ClientID %>");  
   var MasterTable = grid.get_masterTableView();  
 
   var selectedRows = MasterTable.get_selectedItems();  
   for (var i = 0; i < selectedRows.length; i++)  
   {  
     var row = selectedRows[i];  
     var cell = MasterTable.getCellByColumnUniqueName(row, "FilterAbb")  
       
     alert(cell.innerHTML);  
       
    //here cell.innerHTML holds the value of the cell  
   }  
 }  
 

Any help would be appreciated.

 


Thank you,
Anshul.

 

Anshul
Top achievements
Rank 1
 answered on 04 Jun 2009
2 answers
217 views
I recently upgraded from telerik 2008 to 2009 version.  Since that, (I am not sure if this is THE cause), I have trouble with a treeview in my application, when it is ajax updated.  This trouble only occurs in Chrome and Safari.

My treeview is in a usercontrol on a radpageview, inside a radmultipaged, controlled by a radtabstrip.

I enabled the RenderSelectedPageOnly=True property because my tabs may contain a lot of html and I don't want to send everything to the browser.  

With that property set to true, my treeview is only displaying correctly on the first display.  If I do any ajax action on my page that affects the treeview (treeview click or tab change), I lose my correct display of the treeview, I only see the "ul/li" visual, I lose every checkbox images.  I only see a bullet list.  

I have ajax settings activated with radajaxmanagerproxy (no ajaxpanel) for the tabstrip and the treeview, with autopostback on the tabstrip to load the selected radpageview on click.

That was not a trouble with the 2008 Q4 version of radcontrols, and it is not a trouble with Firefox3 and IE8.  This only occurs in Chrome(1/2/3) and Safari (4, certainly 3 also), and with the 2009 Q1 version of radcontrols.
Bridge24
Top achievements
Rank 1
Iron
Iron
 answered on 04 Jun 2009
2 answers
133 views
Hi there, I have a RadGrid (Q1 2009 release) and I want to group by the LanguageID that I am pulling from my LinqDataSource while displaying the accompanying Language instead of the ID.  I am attempting to use the FieldAlias for the Language, but this is not working.  Here is my code.  My LinqDataSource is pulling: SurveyID, SurveyGroupID, SurveyGroupName, LanguageID, Language from the database directly.  I can group by anything, but no matter what I group by, the FieldAlias does not do anything.


<telerik:RadGrid ID="rdgSurveys" runat="server" DataSourceID="ldsSurveys" GridLines="None" Skin="Office2007" AutoGenerateColumns="False"> 
        <MasterTableView DataKeyNames="SurveyID" DataSourceID="ldsSurveys" GroupLoadMode="Client"> 
          <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
          </RowIndicatorColumn> 
          <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
          </ExpandCollapseColumn> 
          <Columns> 
            <telerik:GridButtonColumn Text="Select" CommandName="Select"> 
            </telerik:GridButtonColumn> 
            <telerik:GridEditCommandColumn> 
            </telerik:GridEditCommandColumn> 
            <telerik:GridBoundColumn DataField="SurveyID" DataType="System.Int32" HeaderText="SurveyID" ReadOnly="True" SortExpression="SurveyID" UniqueName="SurveyID"> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="SurveyGroupID" DataType="System.Int32" HeaderText="SurveyGroupID" SortExpression="SurveyGroupID" UniqueName="SurveyGroupID" Visible="False" ReadOnly="true"> 
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="SurveyGroupName" DataType="System.String" HeaderText="SurveyGroupName" SortExpression="SurveyGroupName" UniqueName="SurveyGroupName" Visible="False" ReadOnly="true"> 
            </telerik:GridBoundColumn> 
            <telerik:GridTemplateColumn DataField="LanguageID" DataType="System.Int32" HeaderText="Language" SortExpression="LanguageID" UniqueName="LanguageID"> 
              <EditItemTemplate> 
                <asp:DropDownList ID="ddlLanguages" runat="server" DataSourceID="ldsLanguages" DataTextField="Language" DataValueField="LanguageID" SelectedValue='<%# Bind("LanguageID") %>' Width="200px"> 
                </asp:DropDownList> 
              </EditItemTemplate> 
              <ItemTemplate> 
                <asp:Label runat="server" ID="lblLanguage" Text='<%# Eval("Language") %>'></asp:Label> 
              </ItemTemplate> 
            </telerik:GridTemplateColumn> 
          </Columns> 
          <GroupByExpressions> 
            <telerik:GridGroupByExpression> 
              <SelectFields> 
                <telerik:GridGroupByField FieldName="LanguageID" FieldAlias="Language" HeaderText="Survey Group" /> 
              </SelectFields> 
              <GroupByFields> 
                <telerik:GridGroupByField FieldName="LanguageID" FieldAlias="Language" /> 
              </GroupByFields> 
            </telerik:GridGroupByExpression> 
          </GroupByExpressions> 
          <EditFormSettings> 
            <EditColumn UniqueName="EditCommandColumn1"> 
            </EditColumn> 
          </EditFormSettings> 
        </MasterTableView> 
        <ClientSettings Selecting-AllowRowSelect="True" EnablePostBackOnRowClick="True"> 
          <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
        <FilterMenu EnableTheming="True"> 
          <CollapseAnimation Type="OutQuint" Duration="200"> 
          </CollapseAnimation> 
        </FilterMenu> 
      </telerik:RadGrid> 

Redmond Rinehart
Top achievements
Rank 1
 answered on 04 Jun 2009
2 answers
155 views
Hi ,
I have an AppointmentTemplate referenced in HTML with 2 labels.
How do i edit the properties of these labels within code ?

<AppointmentTemplate>

<asp:Label ID="lblAppointmentHeader2" runat="server" CssClass="appt" Text='<%# Bind("Subject") %>'></asp:Label>

</AppointmentTemplate>


Many Thanks
Mark

Mark
Top achievements
Rank 2
 answered on 04 Jun 2009
0 answers
258 views
I have two sites on the same server is a public and another private, I've created a virtual directory to put all documents and images to upload from the private site and that people who consult the site the public can see. The problem is that when you send me the address error, I put that path when uploading files from radupload.

Option 1:   
f.SaveAs(Server.MapPath("../Documentos/PDF/RRHH/") & f.GetName)  
 
Option 2:   
f.SaveAs(Server.MapPath("~/Documentos/PDF/RRHH/") & f.GetName)   
 
Option 3:   
f.SaveAs(Server.MapPath("/Documentos/PDF/RRHH/") & f.GetName)   
 

 

 

Another Option:
?

Roderick
Top achievements
Rank 1
 asked on 04 Jun 2009
1 answer
42 views
Hi,

I've got 8 RadEditor's on one page, with 7 of them all pointing at the first one's ID to use it's toolbar. The toolbar itself loads fine, and works as expected. The issue is with the 'Spelling' toolbar button, which when clicked on the first editor displays a list of languages, "English (GB)", as that's all I'm listing under SpellCheckerLanguage. Clicking this then loads the spell checker and it works fine. However, clicking the spelling icon on any of the other 7 editors just displays an empty list of languages, and due to this I can't actually initiate a spell check on them.

If this is a known issue please point me in the right direction, as I've searched the forums to no avail.

Many thanks,
Wayne
Wayne
Top achievements
Rank 1
 answered on 04 Jun 2009
3 answers
370 views
Hello
Is it possible to change de scrollbar color?
I'm using the skin Office2007
Thank you

Myriam
Myriam
Top achievements
Rank 1
 answered on 04 Jun 2009
6 answers
165 views
I have an issue that I just cant seem to get correct, and I really do not understand why.

I have a page that loads some HTML from a SQL database and I want it displayed in the RadEditor control.  The idea is to load the record they have marked as default on the page load, and then have a ComboBox so they can switch from record to record.  The html that comes from the database doesn't have any header tags like "<html>" or "<header>", but it is well formed html with style and formatting tags like tables, paragraphs, etc...

 
<tr> 
                        <td align="right"> 
                            Message Template:</td> 
                        <td width="25" align="left"> 
                            &nbsp;</td> 
                        <td align="left"> 
                            <telerik:RadComboBox ID="list_templates" Runat="server" Skin="Sunset"  
                                AppendDataBoundItems="True" AutoPostBack="True" DataTextField="msg_title"  
                                DataValueField="id"  
                                OnSelectedIndexChanged="list_templates_SelectedIndexChanged"  
                                DataSourceID="sqlds_MsgTemplates"> 
                                <CollapseAnimation Duration="200" Type="OutQuint" /> 
                            </telerik:RadComboBox> 
                        </td> 
                    </tr> 
 <tr> 
                        <td align="right"> 
                            Message Subject:</td> 
                        <td> 
                            &nbsp;</td>
                        <td align="left"> 
                            <telerik:RadTextBox ID="txt_Sub" Runat="server" Skin="Sunset" Width="400px" Text=""> 
                            </telerik:RadTextBox> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td colspan="3"><center> 
                            <telerik:RadEditor ID="editor_SEND" runat="server" BorderStyle="None"  
                                EditModes="Preview" Height="400px" Skin="Sunset"  
                                ToolsFile="UserControls/EditorToolbar.xml" Width="700px"> 
                                <Content> 
</Content> 
                            </telerik:RadEditor></center> 
                            <br /> 
                            <br /> 
                            <asp:Button ID="btn_SendMsg" runat="server" CssClass="RadDefaultButton"  
                                Text="Send Message" /> 
                        </td> 
                    </tr> 

On Page Load I want to get the record (which loads successfully) and display it in the control. However on page load when I do the following, the editor is empty and it is not in preview mode - the toolbar buttons are still luminated.
If Not IsPostBack Then 
 
Try 
 
                    Using reader As SqlDataReader = Msg_Info.GetDealerTemplateByID(CInt(Request.QueryString("Record"))) 
 
                        If reader.HasRows Then 
 
                            reader.Read() 
 
                            txt_Sub.Text = reader.GetSqlString(0).ToString() 
                            editor_SEND.Content = reader.GetSqlString(1).ToString() 
 
                        End If 
 
                        reader.Close() 
 
                    End Using 
 
                Catch ex As Exception 
                    'error 
                End Try 
 
End If 



But then when I do this - it works fine:
Protected Sub list_templates_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) 
 
Dim msgID As Integer = list_templates.SelectedValue 
 
Try 
 
                    Using reader As SqlDataReader = Msg_Info.GetDealerTemplateByID(msgID) 
 
                        If reader.HasRows Then 
 
                            reader.Read() 
 
                            txt_Sub.Text = reader.GetSqlString(0).ToString() 
                            editor_SEND.Content = reader.GetSqlString(1).ToString() 
 
                        End If 
 
                        reader.Close() 
 
                    End Using
 
                Catch ex As Exception 
 
                End Try 
 
    End Sub 

They are identical but why doesn't the page load display it properly?



Rumen
Telerik team
 answered on 04 Jun 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?