or
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)); |
| } |
| } |
| <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.
| <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> |
<AppointmentTemplate>
<asp:Label ID="lblAppointmentHeader2" runat="server" CssClass="appt" Text='<%# Bind("Subject") %>'></asp:Label>
</AppointmentTemplate>
Many Thanks
Mark
| 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:
?
|
|||||||||||||||
| <tr> | |||||||||||||||
| <td align="right"> | |||||||||||||||
| Message Subject:</td> | |||||||||||||||
| <td> | |||||||||||||||
| </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> |
| 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 |
| 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 |
