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

Good day Guys,

I have two radgrids on the same page one works perfectly fine with paging and datasource bindings. 

The second grid works with the filtering of raddatepickers. So a user has to filer certain data using the datepickers eg. from "date" to "date". Please note that the datepickers are not inside the grid but outside. i also have a button which is used as click event after the user selecting dates

please see below code client side markup of the second grid which has a problem with the paging

and also the code behind for filtering and and binding to the grid. Im using linq to Sql

protected void btnfilter_Click(object sender, EventArgs e)
      {
        
          DateTime From = Convert.ToDateTime(RadDatePicker1.SelectedDate);
          DateTime To = Convert.ToDateTime(RadDatePicker2.SelectedDate);
 
          //rgApprovedTransactionsLists.MasterTableView.Rebind();
 
 
          var AprrovedTrans = (from s in db.OneTimePins
                               join t in db.TransactionTypes on s.TransactionTypeID equals t.TransactionTypeID
                               join userapp in db.Users on s.ApprovedBy equals userapp.UserID
                               where (s.ApprovedDate >= From && s.ApprovedDate < To)
                               select new
                               {
                                   s.OneTimePinID,
                                   t.TransactionType1,
                                   s.PIN,
                                   s.Amount,
                                   s.WithdrawerID,
                                   s.WithdrawDate,
                                   s.ApprovedDate,
                                   s.CancellationDate,
                                   ApprovedBy = userapp.FirstName + " " + userapp.LastName
 
                               });
 
          rgApprovedTransactionsLists.DataSource = AprrovedTrans.ToList();
          rgApprovedTransactionsLists.DataBind();
 
      }
<div>
          <asp:Label ID="lblMessagefilter" runat="server" ></asp:Label>
      </div>
       <table>
          <tr>
              <td align="center" style="width:50%;">
                <telerik:RadLabel ID="RadLabel1" Text="From :" runat="server">
                  </telerik:RadLabel>
              <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1"  DateInput-DateFormat="dd-MM-yyyy" runat="server">
              </telerik:RadDatePicker>
                
 
              </td>
              <td align="center" class="auto-style1">
                  <telerik:RadLabel ID="RadLabel2" Text="To :" runat="server">
                  </telerik:RadLabel>
                  <telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2"  DateInput-DateFormat="dd-MM-yyyy" runat="server">
              </telerik:RadDatePicker>
                 <telerik:RadButton ID="RadButton1" runat="server"  Text="filter" OnClick="btnfilter_Click" Width="100px">
                  </telerik:RadButton>
              </td>
                               
          </tr>
          </table>
 
 
     - <table width="700px">
          <tr>
              <td>
                  <br />
              </td>
          </tr>
         <tr>
              <td>
                  <telerik:RadGrid ID="rgApprovedTransactionsLists" runat="server" AllowPaging="true" PagerStyle-AlwaysVisible="true" EnableViewState="true"
                      PageSize="10" AllowSorting="true"
                  OnPageIndexChanged="rgApprovedTransactionsLists_PageIndexChanged"
                  OnPageSizeChanged="rgApprovedTransactionsLists_PageSizeChanged"
                  OnNeedDataSource="rgApprovedTransactionsLists_NeedDataSource"
                  Width="1113px"
                  AutoGenerateColumns="False" >
 
                  <MasterTableView DataKeyNames="OneTimePinID" TableLayout ="Fixed" FilterItemStyle-BorderStyle="NotSet" MultiHeaderItemStyle-VerticalAlign="NotSet"  >
                          <Columns>
                              <telerik:GridBoundColumn Visible="false" DataField="OneTimePinID" HeaderText="OneTimePinID" AllowSorting="true" >
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center" />
                              </telerik:GridBoundColumn>
 
                               <telerik:GridBoundColumn DataField="TransactionType1" HeaderText="TransactionType" AllowSorting="true" >
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center" />
                              </telerik:GridBoundColumn>
 
                              <telerik:GridBoundColumn DataField="PIN" HeaderText="One Time Pin"  AllowSorting="true">
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center" />
                              </telerik:GridBoundColumn>
                              
                              <telerik:GridBoundColumn DataField="Amount" HeaderText="Amount" >
                                   <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                   <ItemStyle HorizontalAlign="Center" />
                              </telerik:GridBoundColumn>
 
                              <telerik:GridBoundColumn DataField="WithdrawerID" HeaderText="WithdrawerID" AllowSorting="true">
                                   <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                   <ItemStyle HorizontalAlign="Center" />
                              </telerik:GridBoundColumn>
 
                              <telerik:GridBoundColumn DataField="WithdrawDate" HeaderText="Withdraw Date" AllowSorting="true">
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center"/>
                              </telerik:GridBoundColumn>
                              <telerik:GridBoundColumn DataField="ApprovedDate" HeaderText="Approved Date" AllowSorting="true">
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center"/>
                              </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="CancellationDate" HeaderText="Cancellation Date" AllowSorting="true">
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center"/>
                              </telerik:GridBoundColumn>       
 
                              <telerik:GridBoundColumn DataField="ApprovedBy" HeaderText="Approved By" AllowSorting="true">
                                  <HeaderStyle  Width="100px" HorizontalAlign="Center" Font-Bold="true"/>
                                  <ItemStyle HorizontalAlign="Center"/>
                              </telerik:GridBoundColumn>                                                     
                                                          
                          </Columns>
                       </MasterTableView>
 
                  </telerik:RadGrid>
              </td>
              </tr>
              </table>

 

 

Help anyone will be appreciated 

kind regards

Marc

 

 

 

 

Eyup
Telerik team
 answered on 16 May 2018
0 answers
156 views
Hi All,

I am using Telerik UI for ASP.Net MVC Grid tabstrip. I have two tabs. Problem is that if the model.customerId has decimal in value then it does not call read actions like (.Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" })))  

so if the customerId is "123456" then the controller action "UserVouchers_Read" is called.

if the customerId is "123456.123" then the controller action "UserVouchers_Read" is not called called.

Below is my code in the view. Please suggest what could be wrong here.

@(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserDataVM>()
             .Name("Users")
             .DataSource(dataSource => dataSource
                   .Ajax()
                   .ServerOperation(false)
                   .Read(read => read.Action("Users_Read", "Admin"))
                   .Events(events => events.Error("onError"))
               )
             .Columns(columns =>
             {
                 columns.Bound(userData => userData.UserDataId).Visible(false);
                 columns.Bound(userData => userData.CustomerId).Title("Client ID");
                 columns.Bound(userData => userData.FirstName);
                 columns.Bound(userData => userData.CreatedDate).Title("Created Date");
             })
             .Pageable(pager => pager.Input(true).PageSizes(true))
             .Sortable()
             .Scrollable()
             .Filterable()
             .ClientDetailTemplateId("template")
             .HtmlAttributes(new { style = "height:700px;" })
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=CustomerId#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Voucher Information").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("voucher_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(90).Title("Voucher ID").Filterable(false);
                            columns.Bound(v => v.VoucherNo);
                            columns.Bound(v => v.VoucherValue).Visible(false);
                            columns.Bound(v => v.IsVoucherRedeemedStr).Title("Is Voucher Redeemed");
                            columns.Bound(v => v.CreatedDate).Title("Assigned Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
                items.Add().Text("Email Activity").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("email_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(50).Title("Email ID").Filterable(false);
                            columns.Bound(v => v.CreatedDate).Width(50).Title("Email Sent Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserEmails_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
            })
            .ToClientTemplate())
</script>
Kamran
Top achievements
Rank 1
 asked on 16 May 2018
0 answers
107 views

Hi All,

I am using Telerik UI for ASP.Net MVC Grid tabstrip. I have two tabs. Problem is that if the model.customerId has decimal in value then it does not call read actions like (.Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" })))  

so if the customerId is "123456" then the controller action "UserVouchers_Read" is called.

if the customerId is "123456.123" then the controller action "UserVouchers_Read" is not called called.

Below is my code in the view. Please suggest what could be wrong here.

 

@(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserDataVM>()
             .Name("Users")
             .DataSource(dataSource => dataSource
                   .Ajax()
                   .ServerOperation(false)
                   .Read(read => read.Action("Users_Read", "Admin"))
                   .Events(events => events.Error("onError"))
               )
             .Columns(columns =>
             {
                 columns.Bound(userData => userData.UserDataId).Visible(false);
                 columns.Bound(userData => userData.CustomerId).Title("Client ID");
                 columns.Bound(userData => userData.FirstName);
                 columns.Bound(userData => userData.CreatedDate).Title("Created Date");
             })
             .Pageable(pager => pager.Input(true).PageSizes(true))
             .Sortable()
             .Scrollable()
             .Filterable()
             .ClientDetailTemplateId("template")
             .HtmlAttributes(new { style = "height:700px;" })
)

<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().TabStrip()
            .Name("tabStrip_#=CustomerId#")
            .SelectedIndex(0)
            .Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
            .Items(items =>
            {
                items.Add().Text("Voucher Information").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("voucher_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(90).Title("Voucher ID").Filterable(false);
                            columns.Bound(v => v.VoucherNo);
                            columns.Bound(v => v.VoucherValue).Visible(false);
                            columns.Bound(v => v.IsVoucherRedeemedStr).Title("Is Voucher Redeemed");
                            columns.Bound(v => v.CreatedDate).Title("Assigned Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserVouchers_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
                items.Add().Text("Email Activity").Content(@<text>
            @(Html.Kendo().Grid<BSD.VoucherRedemption.Model.UserVoucherVM>()
                        .Name("email_#=CustomerId#") // template expression, to be evaluated in the master context
                        .Columns(columns =>
                        {
                            columns.Bound(v => v.UserVoucherId).Width(50).Title("Email ID").Filterable(false);
                            columns.Bound(v => v.CreatedDate).Width(50).Title("Email Sent Date");
                        })
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(5)
                            .ServerOperation(false)
                            .Read(read => read.Action("UserEmails_Read", "Admin", new { customerId = "#=CustomerId#" }))
                        )
                        .Pageable()
                        .Sortable()
                        .ToClientTemplate())
                </text>
                );
            })
            .ToClientTemplate())
</script>

Kamran
Top achievements
Rank 1
 asked on 16 May 2018
1 answer
145 views

I cannot for the life of me figure out how to add a local copy of the help files to my VS environment.

Per the Installation help, "The MSI installer unpacks the controls on your computer in a folder named Telerik in your Program Files. Additionally, the installer package adds the Telerik® UI for ASP.NET AJAX help files to your VS.NET IDE and to your local copy of MSDN (if you have one installed)."

I have run and re-run, repaired and updated from the MSI but no matter what I do, nothing shows up in my help viewer.

I've downloaded the ZIP installer and looked for the help installation in there, but to no avail.

Please help.

Thanks,

-- Matt

Marin Bratanov
Telerik team
 answered on 15 May 2018
5 answers
273 views
Is there a way to have the FilterControl display an "EmptyMessage"?
Vessy
Telerik team
 answered on 15 May 2018
7 answers
133 views
Hello-

Do Visio Stencils or designs exist for any of the RadControls?

Thanks,

-Thomas
Sean
Top achievements
Rank 1
 answered on 15 May 2018
0 answers
168 views

I tried this code to filter radgrid from the external radcombox located outside the Grid. And i have a problem with it. Visual Studio debugger and SQL Profiler show that this code works and send to radgrid correct filter expression with the correct filter value. But radgrid doesn't filtrate data with this expression while rebinding. It shows all data without any filtering after rebinding. How can I solve it?
This is my code C#:

protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    radgrid.MasterTableView.FilterExpression = "[service_id] LIKE '%" + ddlService.SelectedValue + "%' ";
    GridColumn column = radgrid.MasterTableView.GetColumnSafe("serv_id");
    column.CurrentFilterFunction = GridKnownFunction.EqualTo;
    column.CurrentFilterValue = ddlService.SelectedValue;
    column.AndCurrentFilterFunction = GridKnownFunction.EqualTo;
    radgrid.MasterTableView.Rebind();
}

This is my code ASPX:

<telerik:RadComboBox ID="ddlService" runat="server" Height="200" Width="240"
  DropDownWidth="310"  DataSourceID="dsServices"
 EmptyMessage="- Select Product -"
HighlightTemplatedItems="true" CausesValidation="false"
Filter="Contains" AppendDataBoundItems="true"
onselectedindexchanged="RadComboBox1_SelectedIndexChanged"
SelectedValue='<%# radgrid.MasterTableView.GetColumn("serv_id").CurrentFilterValue %>'
AllowCustomText="true" AutoPostBack="true" DataTextField="service_name" DataValueField="id"
>
Константин
Top achievements
Rank 1
 asked on 15 May 2018
0 answers
127 views

I tried this code to filter radgrid from the external radcombox located outside the Grid. And i have a problem with it. Visual Studio debugger and SQL Profiler show that this code works and send to radgrid correct filter expression with the correct filter value. But radgrid doesn't filtrate data with this expression while rebinding. It shows all data without any filtering after rebinding. How can I solve it?
This is my code C#:

protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    radgrid.MasterTableView.FilterExpression = "[service_id] LIKE '%" + ddlService.SelectedValue + "%' ";
    GridColumn column = radgrid.MasterTableView.GetColumnSafe("serv_id");
    column.CurrentFilterFunction = GridKnownFunction.EqualTo;
    column.CurrentFilterValue = ddlService.SelectedValue;
    column.AndCurrentFilterFunction = GridKnownFunction.EqualTo;
    radgrid.MasterTableView.Rebind();
}

This is my ASPX code with combox setting:

<telerik:RadComboBox ID="ddlService" runat="server" Height="200" Width="240"
  DropDownWidth="310"  DataSourceID="dsServices"
 EmptyMessage="- Select Product -"
HighlightTemplatedItems="true" CausesValidation="false"
Filter="Contains" AppendDataBoundItems="true"
onselectedindexchanged="RadComboBox1_SelectedIndexChanged"
SelectedValue='<%# radgrid.MasterTableView.GetColumn("serv_id").CurrentFilterValue %>'
AllowCustomText="true" AutoPostBack="true" DataTextField="service_name" DataValueField="id"
>
Константин
Top achievements
Rank 1
 asked on 15 May 2018
0 answers
216 views

I tried this code to filter radgrid from the external radcombox located outside the Grid. And i have a problem with it. Visual Studio debugger and SQL Profiler show that this code works and send to radgrid correct filter expression with the correct filter value. But radgrid doesn't filtrate data with this expression while rebinding. It shows all data without any filtering after rebinding. How can I solve it?

This is my code C#:

protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    radgrid.MasterTableView.FilterExpression = "[service_id] LIKE '%" + ddlService.SelectedValue + "%' ";
    GridColumn column = radgrid.MasterTableView.GetColumnSafe("serv_id");
    column.CurrentFilterFunction = GridKnownFunction.EqualTo;
    column.CurrentFilterValue = ddlService.SelectedValue;
    column.AndCurrentFilterFunction = GridKnownFunction.EqualTo;
    radgrid.MasterTableView.Rebind();
}

 

This is my ASPX code with combox setting:

<telerik:RadComboBox ID="ddlService" runat="server" Height="200" Width="240"
  DropDownWidth="310"  DataSourceID="dsServices"
 EmptyMessage="- Select Product -"
HighlightTemplatedItems="true" CausesValidation="false"
Filter="Contains" AppendDataBoundItems="true"
onselectedindexchanged="RadComboBox1_SelectedIndexChanged"
SelectedValue='<%# radgrid.MasterTableView.GetColumn("serv_id").CurrentFilterValue %>'
AllowCustomText="true" AutoPostBack="true" DataTextField="service_name" DataValueField="id"
>
Константин
Top achievements
Rank 1
 asked on 15 May 2018
14 answers
828 views
Hello,

I am using theEditMode ="Batch"  RadGrid's  feature to modify Data and send those changes to the database, I am populating the RadGrid from from a DataTable using the event OnNeedDataSource,

My question is, How I could send/commit the changes to the database manually? (in the examples seems to be automatic using the SqlDataSource for CRUD operations, if you could provide a code sample would be very appreciate it,

Thanks in advance,
Prashant
Top achievements
Rank 1
 answered on 15 May 2018
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?