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

I am using a Telerik RadGrid to display records I get from executing a stored procedure. The records that are returned from the stored procedure are stored in a DataSet which are then bound to the Grid's Data Source property using the following line of code

grid.DataSource=ds["Table"].DefaultView;
grid.DataBind

Depending on a few check boxes clicked on the page the stored procedure will either execute a join or execute a simple SQL query.

The simple query uses a SELECT * Statement
e.g.
SELECT * FROM Table1 WHERE Table1.Key=@Key

wheres the join statement uses a SELECT DISTINCT
e.g.
SELECT DISTINCT Table1.UserKey, Table1.UserName FROM Table1 INNER JOIN Table 2 on Table1.Key=Table2.ParentKey WHERE Table1.UserKey=@UserKey.

Both queries execute in under a second (we tested this SQL Server Management Studio). The SELECT * Statement returns around 300 records and SELECT DISTINCT returns around 200 records.

Even though the SELECT DISTINCT has fewer records it takes around 10-15 seconds more for the page to render than the SELECT * Statement.

We would really appreciate your feedback on this problem.

ASPX For the telerik grid is as follows

<telerik:RadGrid ID="dgSearch" CssClass="RadGrid RadGrid_CSMi" runat="server" Width="730px"

Font-Size="8pt" AllowSorting="True" AllowPaging="True" PageSize="5" AutoGenerateColumns="False"

EnableEmbeddedSkins="false" OnSelectedIndexChanged="dgSearch_SelectedIndexChanged">

<PagerStyle Mode="NextPrevAndNumeric" />

<AlternatingItemStyle BackColor="#C4E1FF" />

<MasterTableView Width="100%" DataKeyNames="AthleteKey">

<Columns>

<tec:GridButtonColumnWithFilteringSorting HeaderText="Full Name" UniqueName="FullName"

SortExpression="FullName" DataTextField="FullName" DataField="FullName" CommandName="Select"

ButtonType="LinkButton" />

<telerik:GridBoundColumn DataField="ID" HeaderText="ID" />

<telerik:GridCheckBoxColumn DataField="Active" HeaderText="Active" ReadOnly="True" />

<telerik:GridBoundColumn DataField="StatusPractice" HeaderText="Practice Status" />

<telerik:GridBoundColumn DataField="StatusGame" HeaderText="Game Status" />

<telerik:GridBoundColumn DataField="ReleaseDate" HeaderText="Release Date" />

</Columns>

</MasterTableView>

<FilterMenu EnableEmbeddedSkins="False" EnableImageSprites="False">

</FilterMenu>

</telerik:RadGrid>


Thanks,
CSMi
Marin
Telerik team
 answered on 27 Jul 2012
1 answer
270 views
Hello,
The FileExplorer works perfectly in IE 9 and Firefox. In Chrome the File-Icons are not displayed, but the File-Names are displayed as usual.

I´m working with Q1 2012 SP1 and Chrome Version 20.0.1132.57 m 

See the attached File.
Vessy
Telerik team
 answered on 27 Jul 2012
1 answer
128 views
Hello everyone,

I have a The following structure at my aspx page.

RadPanelBar - >RadPanelItem1 - > contractsGrid
                      - >RadPanelItem2 - > RadTabStrip - >RadMultiPage1 - >RadPageView3->RadSplitter1->RadPane1->RadGridInstallments
                                                                                                          - >RadPageView2->UpdatePanel ->Label1
                     - >RadPanelItem3 - > contractsGrid ->UpdatePanel3 ->RadGrid5

UpdatePanel_contract -> HiddenField_contract

What I am trying to achieve:

The user selects a row at contractsGrid
I get the selected id and I change the HiddenField_contract value.
Based on the HiddenField_contract value, the RadGridInstallments , the Label1 and the RadGrid5 have different value, so I want to rebind.

I have managed to do so, by enabling "EnablePostBackOnRowClick" at the contractsGrid.

Although, I don't want the selection to fire a postback at all!!!!!!!!!!

Is there another way to do that?

I would really appreciate any help, because I am really stuck here...... :- (

Regards,
Peny
Kostadin
Telerik team
 answered on 27 Jul 2012
1 answer
66 views
OK,

Not sure how to do this...

Here is a query that will return ONE row:

SELECT  S.PercentFree AS '% Free', S.PercentReduced AS '% Reduced', S.PercentPaid AS '% Paid'
  FROM SchoolDemographics S
WHERE S.SchoolID = @SchoolID
     AND S.SchoolYear = @SchoolYear
     AND S.Grade = 'Total'

I want ONE pie chart to display the numeric values in the "slice" itself with the legend to the right to display column name, i.e.,
 - % Free
 - % Reduced
 - % Paid

Is this possible?
Rosko
Telerik team
 answered on 27 Jul 2012
2 answers
313 views
I am using a Grid control with AJAX binding, and need to run some JavaScript after AJAX request completes. 
Tried defining OnComplete event but it causes a compile error.  Is where a workaround? 

Html.Telerik()
                .Grid(Model)
                .Name("scenarioGrid")
                .DataBinding(dataBinding => dataBinding.Ajax()
                            .Delete("Delete", "Scenario").Select("Index", "Scenario"))
                .DataKeys(keys => keys.Add(c => c.Id))
                .Columns(columns =>
                {
                    columns.Template(o => o.Name).Title("Scenario")
                        .FooterTemplate(@<text>Total @Model.Count() </text>);
                    columns.Bound(o => o.IsLocked);
                    columns.Bound(o => o.ContractMonth);
                    columns.Bound(o => o.CreateDate);
                    columns.Command(commands =>commands.Delete().ButtonType(GridButtonType.Image)).Title("Delete");
                }
                        )
                        .Sortable()
                        .Scrollable(scroll => scroll.Height(200))
                        .ClientEvents(events => events.OnDelete("onDelete").OnComplete("onComplete"))
                )

Compiler Error Message: CS1061: 'Telerik.Web.Mvc.UI.Fluent.GridClientEventsBuilder' does not contain a definition for 'OnComplete' and no extension method 'OnComplete' accepting a first argument of type 'Telerik.Web.Mvc.UI.Fluent.GridClientEventsBuilder' could be found (are you missing a using directive or an assembly reference?)

Source Error:

Line 52:                         .Sortable()
Line 53:                         .Scrollable(scroll => scroll.Height(200))
Line 54:                         .ClientEvents(events => events.OnDelete("onDelete").OnComplete("onComplete"))
Line 55:                 )
Line 56:                             </div>

Source File: c:\AmericanAirlines\RTAS\version9\AA.RecurrentTraining.Web.UI\Areas\Planning\Views\Scenario\Index.cshtml    Line: 54 



Jane
Top achievements
Rank 1
 answered on 27 Jul 2012
1 answer
125 views
Is there anyway to add a few new columns to the create and edit forms of an appointment and store them in a database
Ivana
Telerik team
 answered on 27 Jul 2012
2 answers
233 views
Does anyone hav knowledge on how format a radtimepicker that has been declaratively bound? I would like to show the seconds as well as hours and minutes. Below works, but only displays hours and minutes, not seconds.  Bound to an objectdatasource.
<telerik:RadTimePicker ID="RadTimePicker1" DbSelectedDate='<%# Bind("StartTime", "{0:T}") %>' ZIndex="30001" runat="server">
                                <TimeView runat="server" TimeFormat="HH:mm:ss"></TimeView>                            
                                <DateInput ID="DateInput1" runat="server" DateFormat="hh:mm ttt" DisplayDateFormat="hh:mm ttt">
                                </DateInput>
                                </telerik:RadTimePicker>

Nimesh
Top achievements
Rank 1
 answered on 27 Jul 2012
4 answers
114 views
I have a major client issue and I'm days away from UAT.

I'm using the code below to save the information back to the appointment object when I click Save on the Advanced Form.  The problem is, when I open the appointment again, none of my changes persist. 

I have a feeling that this is due to my scheduler not being tied to a datasource.  Currently, I have a class that creates fake data and sends it to the scheduler on load.  The scheduler is not tied to a datasource because I would like to manipulate the schedule and make many changes, then batch them up and send them to the database at one time.  My plan is to iterate through the calendar and find any events that had changes and send them to my update/insert. 

To recap, my problems are:
- The changes are not getting saved to my appointment object
- Is it possible to send all of the changes to the database at once, instead of every time save is pressed?

Let me know what other code you need to help.


protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ProductionRunMock productionRunBL = new ProductionRunMock();
                List<ProductionRun> productionRuns = productionRunBL.GetProductionRuns();
 
                schMasterScheduler.DataSource = productionRuns;
             
                AddResourceTypes();
                AddResources();
 
                schMasterScheduler.GroupBy = ddlPlant.SelectedValue.ToString();
            }
     }


protected void schMasterScheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
       {
           //This event runs on click of save from the form. Therefore we need to check to see if it's an insert or update.
 
           //moveAppointsRight(e.ModifiedAppointment, e.Appointment);
 
           //pull all the controls out of session so we can find their values
           //required
           RadComboBox ddlMatereial = Session["ddlMaterial"] as RadComboBox;
           RadTextBox txtBatchNumber = Session["txtBatchNumber"] as RadTextBox;
           RadNumericTextBox txtBatchSize = Session["txtBatchSize"] as RadNumericTextBox;
           RadComboBox ddlUnitOfMeasure = Session["ddlUnitOfMeasure"] as RadComboBox;
           RadDateTimePicker dtpStartDateTime = Session["dtpStartDateTime"] as RadDateTimePicker;
           RadNumericTextBox txtDuration = Session["txtDuration"] as RadNumericTextBox;
           RadDateTimePicker dtpEndDateTime = Session["dtpEndDateTime"] as RadDateTimePicker;
           ResourceControl ResVessel = Session["ResVessel"] as ResourceControl;
           CheckBox cbNonProdTime = Session["cbNonProdTime"] as CheckBox;
                 
           //optional
           RadDatePicker calShippingDate = Session["calShippingDate"] as RadDatePicker;
           RadTextBox txtWashPrep = Session["txtWashPrep"] as RadTextBox;
           RadComboBox ddlPriority = Session["ddlPriority"] as RadComboBox;
           CheckBox cbWorkOff = Session["cbWorkOff"] as CheckBox;
           CheckBox cbLocked = Session["cbLocked"] as CheckBox;
           RadTextBox txtRawMaterialDependency = Session["txtRawMaterialDependency"] as RadTextBox;
           RadTextBox txtComments = Session["txtComments"] as RadTextBox;
                 
           //conatinering
           Repeater rtpContainering = Session["rptContainering"] as Repeater;
           RadComboBox ddlContainerType = Session["ddlContainerType"] as RadComboBox;
           RadTextBox txtContainerQuantity = Session["txtContainerQuantity"] as RadTextBox;
 
           //write the values of the controls into the appointment object
           e.ModifiedAppointment.Subject = ddlMatereial.SelectedValue;
           e.ModifiedAppointment.Start = Convert.ToDateTime(dtpStartDateTime.SelectedDate);
           e.ModifiedAppointment.End = Convert.ToDateTime(dtpEndDateTime.SelectedDate);
           e.ModifiedAppointment.Attributes["BatchNumber"] = txtBatchNumber.Text;
           e.ModifiedAppointment.Attributes["UnitOfMeasure"] = ddlUnitOfMeasure.SelectedValue;
           e.ModifiedAppointment.Attributes["BatchSize"] = txtBatchSize.Text;
           e.ModifiedAppointment.Attributes["NonProdTime"] = (cbNonProdTime.Checked) ? "true" : "false";
           e.ModifiedAppointment.Attributes["ShipDate"] = Convert.ToDateTime(calShippingDate.SelectedDate).ToShortDateString();
           e.ModifiedAppointment.Attributes["WashPrep"] = txtWashPrep.Text;
           e.ModifiedAppointment.Attributes["Priority"] = ddlPriority.SelectedValue;
           e.ModifiedAppointment.Attributes["WorkOff"] = (cbWorkOff.Checked) ? "true" : "false";
           e.ModifiedAppointment.Attributes["RawMaterialDependency"] = txtRawMaterialDependency.Text;
           e.ModifiedAppointment.Attributes["Comments"] = txtComments.Text;
           e.ModifiedAppointment.Attributes["IsLocked"] = (cbLocked.Checked) ? "true" : "false";
           e.ModifiedAppointment.Attributes["IsDirty"] = "true";
           //e.Appointment.Resources[0] = Convert.ToInt32(e.Appointment.Resources.GetResourceByType(plantNumber.ToString()));
            
       }

protected void schMasterScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
  {          
      //gets all of the fields
 
      //required fields
      RadComboBox ddlMaterial = e.Container.FindControl("ddlMaterial") as RadComboBox;
      RadTextBox txtBatchNumber = e.Container.FindControl("txtBatchNumber") as RadTextBox;
      RadNumericTextBox txtBatchSize = e.Container.FindControl("txtBatchSize") as RadNumericTextBox;
      RadComboBox ddlUnitOfMeasure = e.Container.FindControl("ddlUnitOfMeasure") as RadComboBox;
      RadDateTimePicker dtpStartDateTime = e.Container.FindControl("dtpStartDateTime") as RadDateTimePicker;
      RadNumericTextBox txtDuration = e.Container.FindControl("txtDuration") as RadNumericTextBox;
      RadDateTimePicker dtpEndDateTime = e.Container.FindControl("dtpEndDateTime") as RadDateTimePicker;
      ResourceControl resVessel = e.Container.FindControl("ResVessel") as ResourceControl;
      CheckBox cbNonProdTime = e.Container.FindControl("cbNonProdTime") as CheckBox;
      Label lblError = e.Container.FindControl("lblError") as Label;
 
      //optional fields
      Panel pnlNonProdOrder = e.Container.FindControl("pnlNonProdOrder") as Panel;
      RadDatePicker calShippingDate = e.Container.FindControl("calShippingDate") as RadDatePicker;
      RadTextBox txtWashPrep = e.Container.FindControl("txtWashPrep") as RadTextBox;
      RadComboBox ddlPriority = e.Container.FindControl("ddlPriority") as RadComboBox;
      CheckBox cbWorkOff = e.Container.FindControl("cbWorkOff") as CheckBox;
      CheckBox cbLocked = e.Container.FindControl("cbLocked") as CheckBox;
      RadTextBox txtRawMaterialDependency = e.Container.FindControl("txtRawMaterialDependency") as RadTextBox;
      RadTextBox txtComments = e.Container.FindControl("txtComments") as RadTextBox;
 
      //containering
      Repeater rptContainering = e.Container.FindControl("rptContainering") as Repeater;
      RadComboBox ddlContainerType = e.Container.FindControl("ddlContainerType") as RadComboBox;
      TextBox txtContainerQuantity = e.Container.FindControl("txtContainerQuantity") as TextBox;
 
      //add the controls to session that we need in other places
      //required
      Session["ddlMaterial"] = ddlMaterial;
      Session["txtBatchNumber"] = txtBatchNumber;
      Session["txtBatchSize"] = txtBatchSize;
      Session["ddlUnitOfMeasure"] = ddlUnitOfMeasure;
      Session["dtpStartDateTime"] = dtpStartDateTime;
      Session["txtDuration"] = txtDuration;
      Session["dtpEndDateTime"] = dtpEndDateTime;
      Session["ResVessel"] = resVessel;
      Session["cbNonProdTime"] = cbNonProdTime;
      Session["lblError"] = lblError;
 
      //optional
      Session["pnlNonProdOrder"] = pnlNonProdOrder;
      Session["calShippingDate"] = calShippingDate;
      Session["txtWashPrep"] = txtWashPrep;
      Session["ddlPriority"] = ddlPriority;
      Session["cbWorkOff"] = cbWorkOff;
      Session["cbLocked"] = cbLocked;
      Session["txtRawMaterialDependency"] = txtRawMaterialDependency;
      Session["txtComments"] = txtComments;
 
      //conatinering
      Session["rptContainering"] = rptContainering;
      Session["ddlContainerType"] = ddlContainerType;
      Session["txtContainerQuantity"] = txtContainerQuantity;
       
      //load materials drop down
      LoadMaterialsDropdown(ddlMaterial, plantNumber);
       
      //fill the form out with the information from appointment object
      if (ViewState["mode"].ToString() == "update")
      {               
          //required               
          ddlMaterial.SelectedValue = e.Appointment.Subject;
          txtBatchNumber.Text = e.Appointment.Attributes["BatchNumber"];
          txtBatchSize.Text = e.Appointment.Attributes["BatchSize"];
          ddlUnitOfMeasure.SelectedValue = e.Appointment.Attributes["UnitOfMeasure"];
          txtDuration.Text = e.Appointment.End.Subtract(e.Appointment.Start).TotalHours.ToString();
          cbNonProdTime.Checked = (e.Appointment.Attributes["NonProdTime"].ToLower() == "true") ? true : false;
 
          //optional
          calShippingDate.SelectedDate = DateTime.Parse(e.Appointment.Attributes["ShipDate"]);
          txtWashPrep.Text = e.Appointment.Attributes["WashPrep"];
          cbWorkOff.Checked = (e.Appointment.Attributes["WorkOff"].ToLower() == "true") ? true : false;
          cbLocked.Checked = (e.Appointment.Attributes["IsLocked"].ToLower() == "true") ? true : false;
          txtRawMaterialDependency.Text = e.Appointment.Attributes["RawMaterialDependency"];
          txtComments.Text = e.Appointment.Attributes["Comments"];
          ddlPriority.SelectedValue = e.Appointment.Attributes["Priority"];
 
          //enable/diable fields based on nonProdTime
          NonProdTimeCheckedChanged();
                        
          //redo this part with the container information
 
          //mock up the containers to fill the middle section of the popup
          ContainersMock containerBL = new ContainersMock();
          List<Container> containers = containerBL.GetContainers();
 
          rptContainering.DataSource = containers;
          rptContainering.DataBind();
      }
       
      else if (ViewState["mode"].ToString() == "insert")
      {
           
      }
  }







Peter
Telerik team
 answered on 27 Jul 2012
1 answer
295 views
We have RadMaskedTextBox control and we are setting the PromptChar and Mask propery of RadMaskedTextBox  as PromptChar="_" and Mask="###-###-####". 
We are accessing the value of RadMaskedTextBox through the javascript like the following:


$("#<%= rmtbPhone.ClientID %>_text").val()


When there is no value in RadMaskedTextBox
For DLL version: 2011.2.816.40, it is giving value as Empty("")
For DLL version: 2012.2.724.40, it is giving value as "___-___-____" instead of Empty("") 

How to get the actual value when using new DLL through Javascript or JQuery?

Thanks in advance,
Ajit
Jayesh Goyani
Top achievements
Rank 2
 answered on 27 Jul 2012
1 answer
101 views
Have a RadListBox with OnItemDataBound going to this method:
protected void listWho_ItemDataBound(object sender, RadListBoxItemEventArgs e)
        {
            if (!IsPostBack)
            {
                    DataRowView dataSourceRow = e.Item.DataItem as DataRowView;
                    string pkValue = dataSourceRow["pk"].ToString();
                    if (pkValue == "51" || pkValue == "53")
                    {
                        e.Item.Selected = true;
                    }
                 
            }
        }


The problem is that dataSourceRow is null.  Why?
Dan
Top achievements
Rank 2
 answered on 27 Jul 2012
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?