Configuring a filter for Devexpress ASPxGridView - filter

I have a column named Status that display an image corresponding to states. And I have a filter on this column. How can I localize?
<dx:GridViewDataImageColumn Caption="Status" FieldName="Status" Width="100px"
ShowInCustomizationForm="True" VisibleIndex="9">
<Settings AllowSort="True" SortMode="Value" AllowHeaderFilter="True" ShowInFilterControl="True" />
<HeaderStyle HorizontalAlign="Center" />
</dx:GridViewDataImageColumn>

I am not sure that I understand your task correctly. However, it seems that you need to use the gridView's HeaderFilterFillItems event to accomplish your task.

Related

RadGrid using OData is returning data but not displaying it

I am using a RadGrid to DataBind to an OData source. Fiddler shows that when the page is loaded a call is made to my OData source and data is returned in JSON format. The RadGrid creates the headers for each column but no data is ever displayed. My code looks exactly like what I find on the web, but nothing seems to work for me. Does anyone have any ideas with what I am doing wrong?
Here is my markup for the RadGrid:
<telerik:RadGrid ID="RadGrid1" runat="server">
<MasterTableView>
<Columns>
<telerik:GridBoundColumn DataField="Id" HeaderText="Id" />
<telerik:GridBoundColumn DataField="BuildingId" HeaderText="Building" />
<telerik:GridBoundColumn DataField="Name" HeaderText="Title" />
<telerik:GridBoundColumn DataField="Capacity" HeaderText="Capacity" />
<telerik:GridBoundColumn DataField="IsActive" HeaderText="Active" />
</Columns>
</MasterTableView>
<ClientSettings>
<DataBinding Location="http://localhost:49937/" ResponseType="JSON">
<DataService TableName="Locations" Type="OData" />
</DataBinding>
</ClientSettings>
</telerik:RadGrid>
And this is a screenshot (via Fiddler) of the data the is being returned:
Thanks for the help.
My guess is that you need to change the ResponseType from JSON to JSONP. The reason is that JSON, or any other http request initiated from javascript is restricted by the same origin policy. But RadGrid allows you to use JSONP to make remote calls to services that support the JSONP data response format.
You can refer to this article for more details
http://www.telerik.com/blogs/radgrid-for-asp-net-ajax-client-side-databinding-to-odata-services

How to get ID for onRowSelected event for asp.net webforms jqGrid?

I have implemented server side jqgrid with the following code
<trirand:JQGrid ID="jQGrid1" runat="server" OnDataRequesting="jQGrid1_DataRequesting" Height="220" LoadOnce="false" OnRowSelecting="jQGrid1_RowSelecting">
<AppearanceSettings ShowRowNumbers="true" />
<Columns>
<trirand:JQGridColumn DataField="AppId" HeaderText="Application ID" PrimaryKey="True" Width="100" />
<trirand:JQGridColumn DataField="Name" HeaderText="Application Name" Width="200"/>
<trirand:JQGridColumn DataField="Link" Width="280" />
</Columns>
<PagerSettings ScrollBarPaging="true" PageSize="20" NoRowsMessage="scroll down to fetch records" CurrentPage="1"/>
</trirand:JQGrid>
But for the onRowSelected Event when i check in my c# code i was getting selected index as some random values like jqg11,jqg25,....
why is it happening .What should i do to make one of my column to set as key when selected
I have checked below options
jQGrid1.SelectedRow
e.RowKey
I don't use commercial version of jqGrid, thus the code which you posted say me almost nothing. Nevertheless the reason of ids like jqg11 and jqg25 are typically errors in filling of the grid. jqGrid requires to assign id attribute to every row. So the server response should contains the id values. The exact information depends on the format of input data which you chosen, from the version of jqGrid which you use and from other options like id property of jsonReader or the existence of key: true property in one column of colModel. I recommend you to verify the JSON/XML data which you use to fill the grid. Probably you ddidn't specified correctly the id values.

Devexpress Gridview Filter Control

I have a ASPxGridView component that is filled from a SQL query
I wanted to apply a filter on my ASPX Gridview
so I wrote:
<dx:ASPxGridView runat="server" ID="gvExecReq" Visible="false" AutoGenerateColumns="true"
OnPageIndexChanged="gvExecReq_PageIndexChanged" OnBeforeColumnSortingGrouping="gvExecReq_BeforeColumnSortingGrouping">
**<Settings ShowFilterRow="True" />
<Settings ShowFilterBar="Visible" ShowHeaderFilterButton="True" />**
</dx:ASPxGridView>
the filter is well established, but it is not functional
What do I need to add more?
Please Use Following Settings For Filter To Be Operational :
<Settings ShowHeaderFilterButton="true"
EnableFilterControlPopupMenuScrolling="True"
ShowFilterBar="Visible" ShowFilterRow="True" ShowFilterRowMenu="True" />
Also In The Columns of The Grid You Can Control The Condition of Filtering i.e. Contains, Equal, Does Not Contain etc.
<dx:GridViewDataColumn Settings-AutoFilterCondition="Contains" Settings-FilterMode="DisplayText">
if in the database filed type is string you can write part of text for search,but is type of int or decimal or so on,you should write ALL text even it can find rows

How to theme Series when using a theme.xml in system.web.helpers.chart

The support on this is currently horrible.
I'm creating my own theme for a System.Web.Helpers.Chart by using a XML file.
I've figured that the XML is basically a serialized version of the UIDataVizualazation namespace.
It works fine but I have no idea how to set theme objects tied to the Series property.
<Chart >
<ChartAreas>
<ChartArea>
<AxisY>
<MajorGrid />
</AxisY>
<AxisX>
<MajorGrid />
</AxisX>
</ChartArea>
</ChartAreas>
<Legends>
<Legend />
</Legends>
</Chart>
This is something I can manage pretty easily but according to the Chart object System.Web.UI.DataVisualization.Charting.Chart
has a series property that is a collection of series objects and
<Series>
<Series />
</Series>
Just doesn't do it. So if someone can point me towards a Xml schema for this or a pointer on how to access the Series property so I can change things like isValueShownAsLabel attribute I would appriciate it
Through experimentation I found that the case matters.
It should be:
<Series>
<series>
</series>
</Series>
Also this property may be of usefulness to anyone that is looking for an answer to this:
CustomProperties="PieLabelStyle=Outside"
Which can be placed in a series or point and perhaps other elements as well.
A list of the properties can be found here.
You can Serialize and Deserialize Chart yourself.
Take a look here Chart Serialization
I know this is too late to help you now but you can change series properties such as line width, colour, and labelling using
<Series>
<Series Name="Default" _Template_="All" BorderWidth="3" IsValueShownAsLabel="True" />
</Series>

Telerik RadGrid - How to disable sorting for a Column?

In their documentation Telerik says that there is a way to disable sorting for specific column by using AllowSorting property. I'm looking at Telerik.Web.UI.GridColumn members and there is no AllowSorting property. There is a Sortable property but its protected and has to be overriden. So what do I use to turn off sorting for specific column?
There is a AllowSorting property on GridBoundColumn but in this case I'm using GridTemplateColumn. Is there a way to turn off sorting on GridTemplateColumn?
The AllowSorting attribute is available from the source/markup view in Visual Studio. For example (simplified):
<tr:RadGrid>
<MasterTableView>
<Columns>
<tr:GridBoundColumn DataField="field" HeaderText="Description"
AllowSorting="false" />
</Columns>
</MasterTableView>
</tr:RadGrid>
I don't know if this works for you? I haven't instantiated my grids from the code-behind files yet, so if that's what you are doing, I can't easily help you. But the above works for me.
EDIT:
Ah it was not clear from the original question, that you were using the GridTemplate column. As you are now using the SortExpression-property, doesn't using the same attribute in the markup work for you? So:
<tr:RadGrid>
<MasterTableView>
<Columns>
<tr:GridTemplateColumn HeaderText="Description" DataField="field"
SortExpression="">
<!-- template here etc. -->
</tr:GridTemplateColumn>
</Columns>
</MasterTableView>
</tr:RadGrid>
Okay, I got the desired effect, I turned off sorting by setting GridTemplateColumn's SortingExpression property to blank.
Grid.Columns.FindByUniqueName("Type").SortExpression = string.Empty;
This looks like a hack. Why isn't there an explicit property to turn off sorting? Oh well. This works.
If you know a better way, let me know.
Thanks.
Telerik now has a new property called HeaderButtonType (exists on a template column too!) which can be set to "None" to render a label instead of a linkbutton for the column header text.
As stated in the Telerik Docs:
In case you want to disable sorting for a particular column only, you can configure column's IsSortable property to False:
<telerik:GridViewColumn IsSortable="False" />
Here's an example showing how to disable sorting for a specific column.
Note the AllowSorting property at the Grid level (for all columns).
Then, in the Columns collection, note how it is turned off for that specific column.
<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True">
<HeaderContextMenu>
<CollapseAnimation Duration="200" Type="OutQuint" />
</HeaderContextMenu>
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn AllowSorting="False" UniqueName="column">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<FilterMenu>
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:RadGrid>
For TemplateColumns, I would try turning off Sorting at the grid level and simply enable it on the columns needed. That way, you won't have to do anything for the TemplateColumn since it will be disabled by default.
You could always supply your own headertemplate with a label as the header instead of a link button if you are using a GridTemplateColumn. A we bit extra work but this works fine. If you are going to disable sorting for all your GridTemplateColumns then your "hack" would be best.

Resources