Telerik Forums
UI for ASP.NET AJAX Forum
11 answers
2.2K+ views

Hi,

I have a radgrid with filter on field set on.  I need to be able to set the filter of a specific field to a fixed value and enable the filter field.  But this is user dependant.

How can I accomplish this?

My radgrid :

<telerik:RadGrid ID="grdCodes" GridLines="None" runat="server" PageSize="20" AllowPaging="True" AutoGenerateColumns="False" AllowFilteringByColumn="true"
           OnInsertCommand="grdCodes_InsertCommand" OnUpdateCommand="grdCodes_UpdateCommand"
           OnNeedDataSource="grdCodes_NeedDataSource" OnItemDataBound="grdCodes_ItemDataBound" OnItemCreated="grdCodes_ItemCreated" OnPreRender="grdCodes_PreRender" >
           <MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" EditMode="InPlace" AutoGenerateColumns="False">
               <Columns>
                   <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" ItemStyle-Width="10px" />
 
                   <telerik:GridTemplateColumn HeaderText="System" ItemStyle-Width="20%" SortExpression="system" UniqueName="system" DataField="system">
                       <FilterTemplate>
                           <telerik:RadComboBox ID="ddlSystemFilter" runat="server" OnClientSelectedIndexChanged="FilterSystemIndexChanged" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("system").CurrentFilterValue %>'>
                               <Items>
                                   <telerik:RadComboBoxItem Text="All" />
                               </Items>
                           </telerik:RadComboBox>
                           <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                               <script type="text/javascript">
                                   function FilterSystemIndexChanged(sender, args) {
                                       var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                       tableView.filter("system", args.get_item().get_value(), "EqualTo");
                                   }
                               </script>
                           </telerik:RadScriptBlock>
                       </FilterTemplate>
                       <ItemTemplate>
                           <%# CartaMundi.BusinessLogic.Codes.GetDescription(cmWeb.Classes.Constants.SYSTEM_GENERAL,"SYSTEM", DataBinder.Eval(Container.DataItem, "system")) %>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <telerik:RadComboBox runat="server" ID="ddlSystem" ></telerik:RadComboBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridBoundColumn DataField="field_name" HeaderStyle-Width="20%" HeaderText="Field name" SortExpression="field_name" UniqueName="field_name" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
                       <ColumnValidationSettings EnableRequiredFieldValidation="true">
                           <RequiredFieldValidator Text="<img src='/CMIT/Images/Warning.gif' border='0'>" Display="Dynamic" ToolTip="Field name is required." ErrorMessage="-Field name is required." ></RequiredFieldValidator>
                       </ColumnValidationSettings>
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="field_value" HeaderStyle-Width="20%" HeaderText="Field value" SortExpression="field_value" UniqueName="field_value" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
                       <ColumnValidationSettings EnableRequiredFieldValidation="true">
                           <RequiredFieldValidator Text="<img src='/CMIT/Images/Warning.gif' border='0'>" Display="Dynamic" ToolTip="Field value is required." ErrorMessage="-Field value is required." ></RequiredFieldValidator>
                       </ColumnValidationSettings>
                   </telerik:GridBoundColumn>
                   <telerik:GridBoundColumn DataField="description" HeaderStyle-Width="40%" HeaderText="Description" SortExpression="description" UniqueName="description" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" >
                       <ColumnValidationSettings EnableRequiredFieldValidation="true">
                           <RequiredFieldValidator Text="<img src='/CMIT/Images/Warning.gif' border='0'>" Display="Dynamic" ToolTip="Description is required." ErrorMessage="-Description is required." ></RequiredFieldValidator>
                       </ColumnValidationSettings>
                   </telerik:GridBoundColumn>
               </Columns>
           </MasterTableView>
           <ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
       </telerik:RadGrid>

The fields that can have fixed values is the GridTemplateColumn 'System' and the GridBoundColumn 'field_value'

I was able to set the default value but there is was no option to set the field enabled.

protected void grdCodes_PreRender(object sender, EventArgs e)
{
     
        if (BLogic.UserRights.Authorised(CurrentUser, "ProjectGroups", "*DSP", Classes.Constants.SYSTEM_DESIGN ))
        {
            grdCodes.MasterTableView.FilterExpression = "(Convert.ToString(it[\"system\"]) = \"" + cmWeb.Classes.Constants.SYSTEM_DESIGN + "\") AND (it[\"field_name\"].ToString().Contains(\"PRJGROUPS\"))";
            GridColumn column = grdCodes.MasterTableView.GetColumnSafe("system");
            column.CurrentFilterFunction = GridKnownFunction.EqualTo;
            column.CurrentFilterValue = cmWeb.Classes.Constants.SYSTEM_DESIGN;
            column = grdCodes.MasterTableView.GetColumnSafe("field_name");
            column.CurrentFilterFunction = GridKnownFunction.EqualTo;
            column.CurrentFilterValue = "PRJGROUPS";
                                 
            grdCodes.MasterTableView.Rebind();
 
        }
}
 

There are users that may not be able to select other values in the filter and have a fixed value.  Other user must be are able to use the filter as they wish.

The part of the code '(BLogic.UserRights.Authorised(CurrentUser, "ProjectGroups", "*DSP", Classes.Constants.SYSTEM_DESIGN ))' decides if the users has limitid selection options.

Can this be done?

Kind regards

Suzy

 

 

Attila Antal
Telerik team
 answered on 15 Aug 2019
1 answer
482 views

Is there a property or a telerik way of putting a text or value in the middle of the donut chart to show total or something.

Please see image as example.

 

Vessy
Telerik team
 answered on 15 Aug 2019
0 answers
127 views

Hi, I currently have 2 Rad Image Editors on my page. I load images to both server side, and I would then like to hide the second, until the client clicks a button to load the second, without postback. If I load each editor to the page, and then use a button click to hide one, and show the selected one, everything works great. However, I can't seem to find the event where all load events have fired for the image editor. I'm currently using OnClientImageLoad(imgEditor) to set visibilty with imgEditor.set_visible(false);

This works great for showing and hiding the editors, but when I try to use Zoom, the editor disappears. When I select to show it again, by clicking my button which uses set_visible() to show the associated Image Editor, I see that the zoom worked on the image, that again disappears when I use the tool.

Quinn
Top achievements
Rank 1
 asked on 14 Aug 2019
3 answers
92 views

Is it Possible to wrap an anchor key(href) around a Donut series segment ?

 

Vessy
Telerik team
 answered on 14 Aug 2019
1 answer
184 views

Using Asp.net Ajax. Below is the prototype.

 

https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/insert-update-delete-hierarchy/defaultcs.aspx

 

My question is that I would like to high light the Last edited/inserted row in Child Table's. Refer to attached.

 

Thanks a lot.

 

 

 

 

Attila Antal
Telerik team
 answered on 14 Aug 2019
10 answers
866 views
Hi, help me
i am using teleric radwindow as a modal popup.
My requirement is Radwindow should close when the user press ESC key from keyboard. radwindow does not have any close() method.  what cod ei have to write.
Rumen
Telerik team
 answered on 14 Aug 2019
3 answers
1.0K+ views
Hello, 

What is the best way to detect if my RadGrid in batch edit mode has had any of its cells modified and has pending unsaved changes?  I understand how to detect and handle the "batchEdit" command being fired to say the grid is up to date, but I am not sure how to detect on the client that a cell was modified.  This is my first time using a RadGrid so excuse my inexperience but I didn't see this question asked elsewhere.
Rumen
Telerik team
 answered on 13 Aug 2019
1 answer
77 views

I'm attempting to use the RadMonthYearPicker inside of a RadGrid EditItemTemplate in BatchEdit mode and I'm having an issue getting the picker to accept and exit all forms of it's editors when the user clicks 'OK'

I've attached a screenshot to help illustrate what I mean.

I have a OnBatchEditCellValueChanged function that then validates the date selected and pulls some DB values to other columns.

I have everything working like I want it accept when using the picker you have to manually click off the row before the changed event will fire.

I've tried several different methods of moving the cursor, setting focus, blurs, saving the table via batch manager and I'm sure a few other things and haven't had success yet.

Any direction at this point would be much appreciated. 

Attila Antal
Telerik team
 answered on 13 Aug 2019
2 answers
134 views

Hi Team,

 

Is it possible to stack or group series on the DonutSeries?

Is there a way to add borderstyle instead of the background color?

Please see screenshot.

 

Andrew
Top achievements
Rank 1
 answered on 13 Aug 2019
6 answers
1.5K+ views

I've been trying to change the selected the item in a radcombox using the following java script code and none of it works:

var comboBox = <%=rc1.ClientID %>;  
comboBox.set_Text = "";  
//document.getElementById("<%=rc1.ClientID %>").value = "";  
  
var ddlQType = $find("<%=rc1.ClientID%>"); 
ddlQType._text = "";
ddlQType.set_selectedItem = "";

What am I doing wrong?
Thanks

 

 

 

 

 

 

 

 

Attila Antal
Telerik team
 answered on 13 Aug 2019
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?