Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
113 views

Hi,

i try to perform filter operation programmatically. So i created an asp button and attached a server side click event handler. The filter operation should be fired in the event handler:

 protected void Filter_Click(object sender, EventArgs e)
 {
            RadGrid grd = grid;
            grid.MasterTableView.FilterExpression = "([Capture] LIKE 'Kind%')"; // Capture is the id and unique name of a GridBoundColumn
            GridColumn column = grid.MasterTableView.GetColumnSafe("Capture");
            column.CurrentFilterFunction = GridKnownFunction.Contains;
            column.CurrentFilterValue = "Kind";
            grd.EnableLinqExpressions = false;
            GridDataItem item = (grid.MasterTableView.GetItems(GridItemType.Item)[2] as GridDataItem);
            item.FireCommandEvent("Filter", new System.Web.UI.Pair("Kind", "Capture")); // exception is being fired at this line
            grid.Rebind();
}

 

This code causes an exception:

 

An exception of type 'System.NullReferenceException' occurred in Telerik.Web.UI.dll but was not handled in user code


   at Telerik.Web.UI.GridColumn.RefreshCurrentFilterValue(GridFilteringItem filteringItem, String functionName)
   at Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source)
   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at Lusd.Presentation.LusdApplication.UserControls.Schule.InstitutionsListeControl.Filter_Click(Object sender, EventArgs e) in C:\TFS\ZeGOV\LUSD\Client\development\standard\Presentation\Presentation.LusdApplication\UserControls\Schule\InstitutionsListeControl.ascx.cs:line 429
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

How can I get it fixed?

 

Thanks in advance

Yazid
Top achievements
Rank 1
 answered on 16 Aug 2016
1 answer
86 views

Hi,

when I try to perform filter operation in a button event handler the FireCommandEvent method causes an exception.

        protected void Filter_Click(object sender, EventArgs e)
        {
            RadGrid grd = grid;
            grid.MasterTableView.FilterExpression = "([Capture] LIKE 'Kind%')";
            GridColumn column = grid.MasterTableView.GetColumnSafe("Capture");
            column.CurrentFilterFunction = GridKnownFunction.Contains;
            column.CurrentFilterValue = "Kind";
            grd.EnableLinqExpressions = false;
            GridDataItem item = (grid.MasterTableView.GetItems(GridItemType.Item)[2] as GridDataItem);
            item.FireCommandEvent("Filter", new System.Web.UI.Pair("Kind", "Capture"));
            grid.Rebind();
        }

Here is the exception:

An exception of type 'System.NullReferenceException' occurred in Telerik.Web.UI.dll but was not handled in user code


   at Telerik.Web.UI.GridColumn.RefreshCurrentFilterValue(GridFilteringItem filteringItem, String functionName)
   at Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source)
   at Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e)
   at Lusd.Presentation.LusdApplication.UserControls.Schule.InstitutionsListeControl.Filter_Click(Object sender, EventArgs e) in C:\TFS\ZeGOV\LUSD\Client\development\standard\Presentation\Presentation.LusdApplication\UserControls\Schule\InstitutionsListeControl.ascx.cs:line 429
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

How can I get it solved?

 

Thanks in advance.

Viktor Tachev
Telerik team
 answered on 16 Aug 2016
1 answer
91 views
Initially, when I need telerik in my project, I only load the main dll. Now, when I go to upgrade wizard, in addition to upgrading telerik, it also loads the zip and document libraries, of which I do not need. Is there a way to opt out of adding those when upgrading?
Maria Ilieva
Telerik team
 answered on 16 Aug 2016
1 answer
72 views

I am using radgrid, i have used asp link button in GridTemplateColumn .

On click of link button i want to get value of label which is different GridTemplateColumn using javascript.

How to fetch value of label by client side.

Please help. Regards

Maria Ilieva
Telerik team
 answered on 16 Aug 2016
1 answer
34 views

Greetings,

Looks like a bug was introduced in 2016.2.719+.  Put the following in a blank web form:

<telerik:RadColorPicker ID="RadColorPicker1" ShowIcon="True" runat="server" SelectedColor="Red"></telerik:RadColorPicker> 
<telerik:RadColorPicker ID="RadColorPicker2" ShowIcon="True" runat="server"></telerik:RadColorPicker>

Select a color in one control and it changes in both controls.

Works fine in 2016.2.712 and earlier.

Thanks,

Gary.

 

Marin Bratanov
Telerik team
 answered on 16 Aug 2016
1 answer
44 views

Hi telerik team.

 

I have some questions, i´m working with a user control like this:

<telerik:RadAjaxManagerProxy runat="server">
    <AjaxSettings>
         <telerik:AjaxSetting AjaxControlID="cbTaxesGroup">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="cbTaxes" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>

<section>
    <div class="col-md-10">
        <telerik:RadComboBox runat="server" ID="cbTaxesGroup" AllowCustomText="false" EmptyMessage="Selecciona" AutoPostBack="true"               OnSelectedIndexChanged="cbTaxesGroup_SelectedIndexChanged"></telerik:RadComboBox><br />
        <telerik:RadComboBox runat="server" ID="cbTaxes" AllowCustomText="true" MarkFirstMatch="true" AutoPostBack="true" OnSelectedIndexChanged="cbTaxes_SelectedIndexChanged"></telerik:RadComboBox><br />        
    </div>    
</section>

 

Each cbTaxes depends of cbTaxesGroup selection...

And i´m using this control inside a RadGrid like:

<telerik:GridTemplateColumn UniqueName="templateTaxesColumn" HeaderText="Impuesto">
                            <ItemTemplate>
                                <%# Eval("TaxDescription") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <ucCustom:ucTaxesCtrl runat="server" ID="cmbTaxes" />
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="cmbTaxes:cbTaxesGroup" CssClass="validate-control" ErrorMessage=" *" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="cmbTaxes:cbTaxes" CssClass="validate-control" ErrorMessage=" *" ForeColor="Red"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

But the problem is that the second radcombobox neves is populate...

Someone can help me please?

Veselin Tsvetanov
Telerik team
 answered on 16 Aug 2016
4 answers
294 views
Hi

I have a radgrid and I am binding the grid from codebehind using stored procedure.
I want edit ,delete images on each row.
On click of edit I should be able all the cells of that row.on delete it should delete the record.
can u just give me one sample?

Regards
Sreedhar
abhishek
Top achievements
Rank 1
 answered on 16 Aug 2016
1 answer
138 views

I am trying to alter the items collection of a radcombobox which is placed in a radtooltip with JS like

 

  <telerik:RadToolTip ID="tt_svg_combo" HideEvent="ManualClose" OffsetX="20" RenderMode="Lightweight" Skin="Default" Width="400" Height="400" runat="server">
       <telerik:RadComboBox ID="rcb_tooltip" runat="server"><Items>
            <telerik:RadComboBoxItem Text="aa" Value="aa" />
                                                             </Items></telerik:RadComboBox>
    </telerik:RadToolTip>

 

 

and JS:

  var ott
                    ott = $find("<%=tt_svg_combo.ClientID%>");
                    var combo = $find("<%= rcb_tooltip.ClientID%>");
                    var items = combo.get_items();
                    combo.trackChanges();
                    var comboItem

var str='1$2$3$4$5'
                    var a = str.split("$");

                    for (i = 0; i < a.length; i++) {
                        comboItem = new Telerik.Web.UI.RadComboBoxItem();
                        comboItem.set_text(a[i]);
                        comboItem.set_value(a[i]);
                        items.add(comboItem);
                    }

                    combo.commitChanges();
                }
              
                setTimeout(function () {
                    ott.show();
                }, 1000);

 

None of the added items are showing up on tooltip show.

When I place rcb on the page itself it works OK

Peter Milchev
Telerik team
 answered on 16 Aug 2016
7 answers
465 views
Hi, i'm building a grid from inverted database table. I had success with your help on GridDateTimeColumn but cant get a numeric textbox in autogenerate insert/edit mode
I get the datatype from a field in the table like

case

 

"datetime":

 

 

case "date":

 

 

case "time":

 

oType =

typeof(DateTime);

 

 

break;

 

 

case "int":

 

 

case "numeric":

 

oType =

typeof(Int32);

 

 

break;

and in ColumnCreated

 

if

 

(e.Column is GridDateTimeColumn && e.Column.UniqueName.Contains("Time"))

 

{

(e.Column

as GridDateTimeColumn).PickerType = GridDateTimeColumnPickerType.TimePicker;

thats all good, but ..

 

if (e.Column is GridNumericColumn

e.column is never a GridNumericColumn, even though the column is built as a Int32(stored as int in the table "Datatype" field

Thanks for any help

Maria Ilieva
Telerik team
 answered on 16 Aug 2016
2 answers
392 views

Hello,

I've been trying to solve the problem by myself for a while now, but in vain.

I have a RadGrid, in which I have a GridClientSelectColumn. I've written JS functions so that selection is saved in a HiddenField even if you navigate through the pages of the grid. The thing is, when I try to export as an Excel file, it doesn't work. I mean that, without adding "IgnorePaging = true", the currently selected rows only are exported. But if I add this property, I would expect that every "selected row" (I mean every row saved in the HiddenField) get exported. Instead, I just get a file with ALL the rows, no matter if they were selected or not. I've been checking the HiddenField content, and it is filled as expected, so I don't know where the problem could come from.

 

Here is the Excel export function : 

public void ExportExcel(RadGrid radGrid)
        {
  // If ignore paging is true, export all data even if not in HiddenField "memory"
            radGrid.ExportSettings.IgnorePaging = true;
            radGrid.ExportSettings.ExportOnlyData = true;
            radGrid.ExportSettings.OpenInNewWindow = true;
            radGrid.MasterTableView.GetColumn("SelectColumn").Visible = false;
  // From here we want to select only registered lines. Work if ignore paging is false
            int count = 0;
            foreach (GridDataItem dataItem in radGrid.MasterTableView.Items)
            {
                if(HiddenField1.Value.IndexOf("," + count + ",") < 0) {
                    dataItem.Visible = false;
                }
                count++;
            }
            radGrid.MasterTableView.ExportToExcel();
        }

Selected rows are "saved" in the hidden field with JS like this : 

function AddorRemoveIdInHiddenField(hf, id, IsAdd) {
 
                if (document.getElementById(hf).value == "") {
                    document.getElementById(hf).value = ",";
                }
 
                if (IsAdd == true) {
                    if (document.getElementById(hf).value.indexOf("," + id + ",") == -1) {
                        document.getElementById(hf).value = document.getElementById(hf).value + id + ",";
                    }
                }
                else if (IsAdd == false) {
                    if (document.getElementById(hf).value.indexOf("," + id + ",") >= 0) {
                      document.getElementById(hf).value = document.getElementById(hf).value.replace("," + id + ",", ",");
                    }
                }
            }

Here is my RadGrid code : 

<telerik:RadGrid ID="rgAgents" runat="server" RenderMode="Lightweight" Culture="fr-FR" OnNeedDataSource="rgAgents_NeedDataSource" AutoGenerateColumns="false" AllowPaging="True" AllowMultiRowSelection="true" OnItemCreated="rgAgents_ItemCreated" AllowSorting="True" GridLines="None" PageSize="15" MasterTableView-ExpandCollapseColumn-Display="false" AllowFilteringByColumn="true">
 <PagerStyle Mode="Slider" Position="Bottom" PageSizeControlType="None"></PagerStyle>
 <GroupingSettings CaseSensitive="false" />
 <MasterTableView AutoGenerateColumns="false" TableLayout="Fixed" DataKeyNames="ID" ClientDataKeyNames="ID">
  <NestedViewTemplate></NestedViewTemplate>
     <columns>
       <telerik:GridClientSelectColumn UniqueName="SelectColumn"></telerik:GridClientSelectColumn>
        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Visible="false">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Nom" HeaderText="Nom">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Prénom" HeaderText="Prénom">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Matricule" HeaderText="Matricule">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Groupe" HeaderText="Groupe">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Service" HeaderText="Service">
        </telerik:GridBoundColumn>
        <telerik:GridDateTimeColumn DataField="Mail" HeaderText="Mail" AllowFiltering="false">
        </telerik:GridDateTimeColumn>
        <telerik:GridBoundColumn DataField="Téléphone" HeaderText="Téléphone" AllowFiltering="false">
        </telerik:GridBoundColumn>
    </columns>
   </MasterTableView>
   <ClientSettings>
   <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />
   <ClientEvents OnRowCreated="rgAgents_RowCreated" OnRowSelected="rgAgents_RowSelected"
            OnRowDeselected="rgAgents_RowDeselected" OnGridCreated="GridCreated" />
   </ClientSettings>
   </telerik:RadGrid>
   <asp:HiddenField ID="HiddenField1" runat="server" Value="" ClientIDMode="Static" />

Florent
Top achievements
Rank 1
 answered on 16 Aug 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?