Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
197 views
Hi all,

This is my first posting here and I could use your help.  I am trying to figure out how to keep my values when using a radcombo box when filtering my grid.  Each time I select an option, the selected value always go back to the first in the list.  So I added some code in the cs file to retain the value, but I get an error.  I could use your expertise!  I have cut/pasted the code and the error message below.

Here is the Aspx:

 

<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" DataSourceID="FastTrackDataSource" GridLines="None" Skin="Outlook" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" OnItemDataBound="RadGrid1_ItemDataBound" EnableLinqExpressions="false">
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID,PersonId,LastName,FirstName,PositionId,BduId,bureau_name,division_name,unit_name,Status" DataSourceID="FastTrackDataSource">
            <CommandItemSettings ExportToPdfText="Export to PDF">
            </CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="EmployeeId" FilterControlAltText="Filter EmployeeId column" HeaderText="Employee ID" SortExpression="EmployeeId" UniqueName="EmployeeId" DataType="System.Int32" ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LastName" FilterControlAltText="Filter LastName column" HeaderText="Last Name" SortExpression="LastName" UniqueName="LastName" ReadOnly="True">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="Filter FirstName column" HeaderText="First Name" ReadOnly="True" SortExpression="FirstName" UniqueName="FirstName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="JobTitle" FilterControlAltText="Filter JobTitle column" HeaderText="Job Title" SortExpression="JobTitle" UniqueName="JobTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="division_name" FilterControlAltText="Filter division_name column" HeaderText="Division" ReadOnly="True" SortExpression="division_name" UniqueName="division_name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="unit_name" FilterControlAltText="Filter unit_name column" HeaderText="Unit" ReadOnly="True" SortExpression="unit_name" UniqueName="unit_name">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Status" DataType="System.Int32" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
                 <FilterTemplate>
                        <telerik:RadComboBox ID="StatusCombo" runat="server" OnSelectedIndexChanged="StatusCombo_SelectedIndexChanged" AutoPostBack="true">
                            <Items>
                                <telerik:RadComboBoxItem Text="All" Value="ALL" />
                                <telerik:RadComboBoxItem Text="Active" Value="1"></telerik:RadComboBoxItem>
                                <telerik:RadComboBoxItem Text="Inactive" Value="0"></telerik:RadComboBoxItem>
                            </Items>
                        </telerik:RadComboBox>
                    </FilterTemplate>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Start_date" DataType="System.DateTime" FilterControlAltText="Filter Start_date column" HeaderText="Start Date" SortExpression="Start_date" UniqueName="Start_date">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="End_date" DataType="System.DateTime" FilterControlAltText="Filter End_date column" HeaderText="End Date" SortExpression="End_date" UniqueName="End_date">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="FastTrackDataSource" runat="server" ConnectionString="name=FastTrackEntities" DefaultContainerName="FastTrackEntities" EnableFlattening="False" EntitySetName="CPS_SocialWorkers" EnableUpdate="True">
    </asp:EntityDataSource>

Here is the code-behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CPSTrainingLog.DAL;
using Telerik.Web.UI;
using System.Drawing;
  
namespace CPSTrainingLog
{
    public partial class CPSSocialWorkersListing : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
              
        }
         
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                if (item["Status"].Text == "1")
                {
                    item["Status"].Text = "Active";
                    item["Status"].ForeColor = Color.Green;
                }
                else if (item["Status"].Text == "0")
                {
                    item["Status"].Text = "Inactive";
                    item["Status"].ForeColor = Color.Red;
                }
            }
  
        }
  
        protected void StatusCombo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            GridFilteringItem item = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
            RadComboBox radComboBoxFilterStatus = item["Status"].Controls[0] as RadComboBox;
            string filterStatus = Convert.ToString(radComboBoxFilterStatus.SelectedValue);
            RadGrid1.MasterTableView.FilterExpression = string.Empty;
            if (e.Value.Equals("1") || e.Value.Equals("0"))
            {
                RadGrid1.MasterTableView.FilterExpression = RadGrid1.MasterTableView.FilterExpression + string.Format("it.[Status] = {0}", Convert.ToInt32(e.Value));
            }
            GridColumn columnID = RadGrid1.MasterTableView.GetColumnSafe("Status");
            columnID.CurrentFilterValue = filterStatus;
            RadGrid1.Rebind();
             
        }
  
          
  
         
    }
}

and here is the error i get after filtering on the Status column:

Server Error in '/' Application.
--------------------------------------------------------------------------------
  
Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
  
Source Error: 
  
  
Line 41:             GridFilteringItem item = RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0] as GridFilteringItem;
Line 42:             RadComboBox radComboBoxFilterStatus = item["Status"].Controls[0] as RadComboBox;
Line 43:             string filterStatus = Convert.ToString(radComboBoxFilterStatus.SelectedValue);
Line 44:             RadGrid1.MasterTableView.FilterExpression = string.Empty;
Line 45:             if (e.Value.Equals("1") || e.Value.Equals("0")) 
  
Source File: c:\Users\huntra\Documents\Visual Studio 2012\Projects\CPSTrainingLog\CPSTrainingLog\CPSSocialWorkersListing.aspx.cs    Line: 43 
  
Stack Trace: 
  
  
[NullReferenceException: Object reference not set to an instance of an object.]
   CPSTrainingLog.CPSSocialWorkersListing.StatusCombo_SelectedIndexChanged(Object sender, RadComboBoxSelectedIndexChangedEventArgs e) in c:\Users\huntra\Documents\Visual Studio 2012\Projects\CPSTrainingLog\CPSTrainingLog\CPSSocialWorkersListing.aspx.cs:43
   Telerik.Web.UI.RadComboBox.OnSelectedIndexChanged() +191
   Telerik.Web.UI.RadComboBox.RaisePostDataChangedEvent() +37
   Telerik.Web.UI.RadDataBoundControl.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +13
   System.Web.UI.Page.RaiseChangedEvents() +132
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1644
   
  
  
--------------------------------------------------------------------------------


Shinu
Top achievements
Rank 2
 answered on 15 Jan 2013
9 answers
272 views
I have an autocompletebox in a div with display:none set. If I change the display on the div to make the autocompletebox visible it does not work. However if when the page loads the div is not hidden it works perfectly.
Matthew Botting
Top achievements
Rank 1
 answered on 15 Jan 2013
1 answer
80 views
Hi,
I need to build 3 autocompletebox related each other (Region, Province and City) with webservices. I dont understand how to build relation becouse I found only samples about related combo boxes.

Thanks
MasterChiefMasterChef
Top achievements
Rank 2
 answered on 14 Jan 2013
1 answer
135 views
Hi,

I have a RadDateTimepicker and changed the font size to 20px and when I assign a date/time to it using SelectedDate, the text is truncated.  See attached picture and notice the PM is missing.  I have pasted my code.

Datey.SelectedDate = now

Browser: IE 10

When I change the font to 15px, all shows fine.

Thanks.
Tim

<telerik:RadDateTimePicker ID="Datey" Style="vertical-align: middle;" Width="300px" runat="server" Skin="Default" Culture="English (United States)" EnableTyping="False">
                                                                            <DateInput runat="server" Font-Size="20px" >
                                                                            </DateInput>
                                                                            <Calendar ID="Calendar1" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Telerik" ShowRowHeaders="False" runat="server">
                                                                                <SpecialDays>
                                                                                    <telerik:RadCalendarDay Repeatable="Today">
                                                                                        <ItemStyle CssClass="rcToday" />
                                                                                    </telerik:RadCalendarDay>
                                                                                </SpecialDays>
                                                                            </Calendar>
                                                                        </telerik:RadDateTimePicker>



										
MasterChiefMasterChef
Top achievements
Rank 2
 answered on 14 Jan 2013
1 answer
160 views
I am in the process of taking all my Sql reports in sql reporting and moving to Telerik reporting.  Went to it becuase it was easy but its hard to maintain another server.  So what I would like is help in developing my first chart.  what I need to do is pull my information from a database and then rotate through it to add my data.  My first chart is pretty simple I need to create the side lengend based on amount of personnel it pulls from the database and then create a legend based on if they had have certain reviews done on them.
Annual
Ready
Not COmpleted

These should be in bar chart to show this.  My question is how to do this.  Are these seperate series or one series, i don't get the linog on the asp.net side.

How can i rotate through my datatable to get all this.

<telerik:RadChart ID="RadChart1" runat="server" Width="500px" >
            <Legend>
                <Items>
                
                </Items>
            </Legend>
        </telerik:RadChart>

Select Total, Readiness, Annual, NoComplete from #TempCount

So total would be the bar charts left legend for total # of personnel subdivided into 20 personl incriments,
then you would have 3 bars Readines, Annual and noComplete.
MasterChiefMasterChef
Top achievements
Rank 2
 answered on 14 Jan 2013
2 answers
129 views
Hello forums,

We are having a weird issue with RadChart in that sometimes the chart goes wonky when it is placing the labels for the dots on a line chart.  Yes, the dots are a bit close together, but it doesn't seem like they are all that terribly close together.  It's possible that this is just a RadChart bug.  We are currently using RadChart (ASP.net AJAX) version 2012.2.828.40.  Attached are some sample graphs for you to peruse.  Any suggestions of things we could try to tweak to keep this from happening would be welcome.

Thanks in advance,

Scott
Missing User
 answered on 14 Jan 2013
1 answer
95 views
Hi Friends,

We have requirement to display the image in the particular position of the every series item of StackedBarchart. When we tried this, the whole value of series item is changed as image. 

  foreach (ChartSeriesItem seriesItem in seriesGroup.Items) 
        { 
              seriesItem.Appearance.FillStyle.FillSettings.BackgroundImage = "~/starimage.jpg"; 
               seriesItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Image; 

        }


For your reference, required chart image file is attached.

Please help us to achieve this functionality.

Regards,
K.Prabhu




MasterChiefMasterChef
Top achievements
Rank 2
 answered on 14 Jan 2013
0 answers
116 views
Hi,

I have 2 related comboboxes which works perfectly without AJAXManager; but when you turn on the AJAXManager, it fires the event but the second combobox is not clickable or nothing happens (no dropdown) when clicking the dropdown button. The controls are within a ASCX page that is loaded dynamically into a RADMultipage PageView during runtime.

<div>
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
          EnablePageHeadUpdate="False">
          <AjaxSettings >
              <telerik:AjaxSetting AjaxControlID="cboApplication" EventName="SelectedIndexChanged">
                  <UpdatedControls>
                      <telerik:AjaxUpdatedControl ControlID="cboComponents" />
                  </UpdatedControls>
              </telerik:AjaxSetting>
          </AjaxSettings>
      </telerik:RadAjaxManager>
 
  </div>
      <div class="contents">
          <table>
              <tr> <td class="LabelColumn"><asp:Label ID="lblApplication" CssClass="Labels" Text="Application: " runat="server"></asp:Label></td> <td colspan="3">
                  <telerik:RadComboBox ID="cboApplication" runat="server" AutoPostBack="True"  OnSelectedIndexChanged="cboApplication_SelectedIndexChanged"
                      Width="320px" />
                  </td> </tr>
              <tr><td class="LabelColumn"><asp:Label ID="lblComponent" Text="Component: " CssClass="Labels" runat="server"></asp:Label></td> <td colspan="3"><telerik:RadComboBox ID="cboComponents" runat="server" Width="320px" /></td></tr>
              <tr><td class="LabelColumn"><asp:Label ID="lblRType" runat="server" Text="Type: " /></td><td colspan="3"><telerik:RADComboBox ID="cboReleaseType" Width="320px" runat="server" /></td></tr>
              <tr><td class="LabelColumn"><asp:Label ID="lblVersion" Text="Version: " CssClass="Labels" runat="server"></asp:Label></td> <td colspan="3"><telerik:RadTextBox ID="txtVersion" runat="server" Width="320px" /></td></tr>
              <tr><td class="LabelColumn"><asp:Label ID="lblArea" runat="server" Text="Area: " /></td><td colspan="3"><telerik:RadComboBox ID="cboArea" runat="server" Width="316px" /></td></tr>
              <tr><td class="LabelColumn"><asp:Label ID="lblDeployTime" Text="Deploy Time: " runat="server" /></td>
                  <td><telerik:RadNumericTextBox ID="txtDeployTime" runat="server" Width="110px" /></td>
                  <td class="LabelColumn"><asp:Label runat="server" ID="lblRevertTime" Text="Revert Time: " /> </td>
                  <td><telerik:RadNumericTextBox ID="txtRevertTime" runat="server" Width="110px" /></td>
              </tr>
           </table>
      </div>
Protected Sub cboApplication_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cboApplication.SelectedIndexChanged
    Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("mConnectionString").ConnectionString)
 
    Dim adapter As New SqlDataAdapter("SELECT * FROM tblComponents WHERE AppID = " & e.Value & " order by ComponentName", connection)
    Dim dt As New DataTable()
    adapter.Fill(dt)
 
    cboComponents.DataTextField = "ComponentName"
    cboComponents.DataValueField = "ComponentID"
    cboComponents.DataSource = dt
    cboComponents.DataBind()
    'insert the first item
    cboComponents.Items.Insert(0, New RadComboBoxItem(""))
End Sub


Any help would be appreciated
Viswanathan
Top achievements
Rank 1
 asked on 14 Jan 2013
2 answers
99 views
We have a requirement for displaying the RadChart control as a one of the column in RadGrid. We tried to display the chart in the column of the grid control. but the area of title, legend, xaxis, yaxis values are displayed as empty. so the alignment of grid control is getting differently.

In one of the telerik forum, assigning of the AutoLayout property set to false. we tried this also but still we are helpless.

please assist to achieve this scenario.

Thanks,
Meenakshi.
Missing User
 answered on 14 Jan 2013
3 answers
119 views
When inserting table from word (clearing word formatting)- it looses some formatting (borders and background colors)

Problem appears in RadControls for ASP.NET AJAX 2012.3 1218
.net framework 4.5
Rumen
Telerik team
 answered on 14 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?