Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
341 views
Hi all. After upgrading to the 2009 Q2 version of ASP.NET AJAX controls, the filterexpression property of radgrid does not work anymore. I mean that the initial filter(When page load) is not filtering anything. My radgrid is binded using a list of custom objects, and the filterexpression code block that I use is:

if (Assembly.GetAssembly(typeof(ScriptManager)).FullName.IndexOf("3.5") != -1)
            {
                rgMenu.MasterTableView.FilterExpression = @"it[""ParentMenuID""] == Guid.Empty";
            }
            else
            {
                rgMenu.MasterTableView.FilterExpression = "ParentMenuID== Guid.Empty";
            }


In the avobe mentioned code, ParentMenuID is a property of my custom object, and I want to filter the list of this objects, showing only the ones who have ParentMenuID == Guid.Empty.

I will really appreciate your help and response.

Thanks  a lot

Ivan Aquino
Tsvetoslav
Telerik team
 answered on 19 Aug 2009
1 answer
164 views
Hi,

I am programmatically creating some RadNumericTextBoxes (see code below).

I have 2 questions:

1,When the page is rendered the boxes appear and all looks fine, however when I mouse over any of the boxes they change size slightly (they reduce by about 4px) and remain that size.  This is a bit weird and unsightly.  Is there anything I can do to prevent this?

2, How can I get the fully qualified ClientID programmatically at creation?  I find that ClientId just contains the Controls ID...

                        ResultsRadNumericTextBox = new RadNumericTextBox(); 
                        ResultsRadNumericTextBox.Type = NumericType.Number; 
                        ResultsRadNumericTextBox.ID = "EntrantHoleResult" + EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"].ToString(); 
                        ResultsRadNumericTextBox.Text = EntrantsResultsData.Table.Rows[DataIndex]["Score"].ToString(); 
 
                        if (Convert.ToInt32(EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"]) < HoleCount) 
                        { 
                            TargetControl = "ctl00_Content_EntrantResultsEntry1_EntrantHoleResult" + (Convert.ToInt32(EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"]) + 1).ToString() + "_text"
                        } 
                        else 
                        { 
                            TargetControl = btnAddEntrantsScores.ClientID; 
                        } 
 
                        ResultsRadNumericTextBox.TabIndex = (Int16)(Convert.ToInt32(EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"]) + 100); 
                        ResultsRadNumericTextBox.Attributes["onKeyUp"] = "return SendTab('" + TargetControl + "', this, event);"
                        ClientIds[DataIndex] = ResultsRadNumericTextBox.ClientID; 
                        ResultsRadNumericTextBox.Width = 14; 
                        ResultsRadNumericTextBox.MinValue = 1; 
                        ResultsRadNumericTextBox.MaxValue = 19; 
                        ResultsRadNumericTextBox.MaxLength = 2; 
                        ResultsRadNumericTextBox.NumberFormat.DecimalDigits = 0; 
                        ResultsRadNumericTextBox.CssClass = EntryNumericTextBoxCellCssClass; 
                        ResultsRadNumericTextBox.ShowSpinButtons = false
                        ResultsCell.Text = ResultsRadNumericTextBox.ClientID; 
 
                        ResultsCell.Controls.Add(ResultsRadNumericTextBox); 
                        ResultsRow.Cells.Add(ResultsCell); 
Iana Tsolova
Telerik team
 answered on 19 Aug 2009
1 answer
130 views
Hi all,

I need to create a page that dynamically creates between 1 and about 30 RadNumericTextBoxes on a page.  I have no problem with this but I need to assign a onKeyPress event to the dynamically created controls.  The javascript in the onKeyEvent needs to check the value in the RadNumericTextBox is 1 digit and NOT a 1, if so tab to the next control.  If it is a 1 allow one more digit to be entered and then tab to the next control.

I have spent a while trying to resolve this but to no joy and to be honest I am not quite sure what state my code is currently in!

Anyway, has anyone got any ideas about how to do this or has done it before?

Not sure what use my code is as its probably not in its previously semi-working state, but here goes:

private void DrawResultsTable(DataView EntrantsResultsData) 
        { 
 
            if (EntrantsResultsData != null
            { 
                int HoleCount = EntrantsResultsData.Count; 
                int RowCount = Convert.ToInt16(HoleCount / 9); 
                int LeftOverCells = Convert.ToInt16(HoleCount % 9); 
                int MinCells = HoleCount > 9 ? 9 : HoleCount; 
 
                TableRow ResultsRow; 
                TableCell ResultsCell; 
                RadNumericTextBox ResultsRadNumericText; 
 
                int DataIndex; 
 
                for (int i = 0; i < RowCount; i++) 
                { 
                    ResultsRow = new TableRow(); 
                    ResultsRow.CssClass = EntryRowCssClass; 
 
                    for (int y = 0; y < MinCells; y++) 
                    { 
                        DataIndex = i * 9 + y; 
 
                        ResultsCell = new TableCell(); 
                        ResultsCell.Text = EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"].ToString() + ":"
                        ResultsCell.CssClass = EntryLabelCellCssClass; 
                        ResultsCell.Attributes["align"] = "right"
                        ResultsRow.Cells.Add(ResultsCell); 
 
                        ResultsCell = new TableCell(); 
                        ResultsCell.CssClass = EntryNumericTextBoxCellCssClass; 
                        ResultsRadNumericText = new RadNumericTextBox(); 
                        ResultsRadNumericText.Type = NumericType.Number; 
                        ResultsRadNumericText.ID = "EntrantHoleResult" + EntrantsResultsData.Table.Rows[DataIndex]["Ordinal"].ToString(); 
                        ResultsRadNumericText.Text = EntrantsResultsData.Table.Rows[DataIndex]["Score"].ToString(); 
                        ResultsRadNumericText.ClientEvents.OnKeyPress = "SendTab(this, 'EntrantHoleResult12',event);"
                        ResultsRadNumericText.Width = 14; 
                        ResultsRadNumericText.MinValue = 1; 
                        ResultsRadNumericText.MaxValue = 19; 
                        ResultsRadNumericText.MaxLength = 2; 
                        ResultsRadNumericText.NumberFormat.DecimalDigits = 0; 
                        ResultsRadNumericText.CssClass = EntryTextBoxCssClass; 
                        ResultsRadNumericText.ShowSpinButtons = false
                        ResultsCell.Text = ResultsRadNumericText.ClientID; 
 
                        ResultsCell.Controls.Add(ResultsRadNumericText); 
                        ResultsRow.Cells.Add(ResultsCell); 
                    } 
 
                    EntrantsResultsTable.Rows.Add(ResultsRow); 
                } 
 
                ResultsRow = new TableRow(); 
                ResultsCell = new TableCell(); 
                ResultsCell.Text = "<br />"
                ResultsCell.ColumnSpan = (MinCells * 2); 
                ResultsRow.Cells.Add(ResultsCell); 
                EntrantsResultsTable.Rows.Add(ResultsRow); 
 
                ResultsRow = new TableRow(); 
                ResultsCell = new TableCell(); 
                ResultsCell.ColumnSpan = (MinCells * 2); 
                ResultsCell.Attributes["align"] = "right"
 
                Button btnAddEntrantsScores = new Button(); 
                btnAddEntrantsScores.ID = "btnAddEntrantsScores"
                btnAddEntrantsScores.Attributes["width"] = "50px"
                btnAddEntrantsScores.Text = "Save"
                btnAddEntrantsScores.Click += new EventHandler(this.btnAddEntrantsScores_Click); 
 
                Button btnCancelEntrantsScores = new Button(); 
                btnCancelEntrantsScores.ID = "btnCancelEntrantsScores"
                btnCancelEntrantsScores.Attributes["width"] = "50px"
                btnCancelEntrantsScores.Text = "Cancel"
                btnCancelEntrantsScores.Click += new EventHandler(this.btnCancelEntrantsScores_Click); 
 
 
                ResultsCell.Controls.Add(btnAddEntrantsScores); 
                ResultsCell.Controls.Add(btnCancelEntrantsScores); 
 
                ResultsRow.Cells.Add(ResultsCell); 
 
                EntrantsResultsTable.Rows.Add(ResultsRow); 
            } 

<script type="text/javascript"
 
    function SendTab(nextField, strField, evtKeyPress) { 
        alert("hi"); 
        var aKey = evtKeyPress.keyCode ? 
    evtKeyPress.keyCode : evtKeyPress.which ? 
      evtKeyPress.which : evtKeyPress.charCode; 
 
 
        if (aKey == 13) { 
            document.getElementById(nextField).focus(); 
        } 
 
 
 
 
        //Check its text   
        if (aKey == 49 && document.getElementById(strField).value == '') { 
            return; 
        } 
        else { 
            document.getElementById(nextField).focus(); 
        } 
 
 
    }   
</script> 


Any help appreciated, ta.
Iana Tsolova
Telerik team
 answered on 19 Aug 2009
3 answers
119 views
Hey,

I have a RadGrid on my page and I am trying to access the information that I am editting and I am having a problem with the TemplateColumn.  This is the code that I am using to traverse through a Grid that is all text and it works great but when I try to edit it to work on Template Columns I keep getting that the column is null when it has Data in it.  Just so you know that when I am using a TemplateColumn I have a RadComboBox inside it and that is what I am trying to grab the information from when i am updating or inserting.  I am making the change to make the editor be a RadComboBox but it is still giving me null values when there is data in my ComboBox.

foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
if (column is IGridEditableColumn)
{
IGridEditableColumn editableCol = (column as IGridEditableColumn);
if (editableCol.IsEditable)
{
IGridColumnEditor editor = editManager.GetColumnEditor(editableCol);
if (editor is GridTextColumnEditor)
{
if (Decimal.Parse((editor as GridTextColumnEditor).Text) > 0)
{
offerValues[i] = Decimal.Parse((editor as GridTextColumnEditor).Text);
i++;
}
else
{
status = false;
}
}
}
}
}
Tsvetoslav
Telerik team
 answered on 19 Aug 2009
0 answers
86 views
Hi,

I have a radwindow that displays a standard bill with address, product, payment, etc. I can print this without problem using client side script but would like to send the entire window contents as an html email. I would assume I would need to go through the controls and use RenderControl, but wanted to see if anyone else had done this and if there are any issues. Thanks.
Karl Wilkens
Top achievements
Rank 1
 asked on 19 Aug 2009
1 answer
141 views
According to this blog post, requests must be bigger than 8K to be compressed.

However I find that my AJAX call I did without RadCompression is 56 bytes, with it is 170+ bytes.

How come it grew, albeit slightly?

How do I get/set the threshold?

Thanks.
Daniel
Telerik team
 answered on 19 Aug 2009
2 answers
169 views
Hi,

I have created a TabStrip where the content each tab is loaded on demand as shown on the demos. The content  of each tab is a User Control and added at runtime through the PageViewCreated event.

Each tab loads as expected but when I tried to attach an OnClientSelectedIndexChanged event (combo1_selected ) to a combo box on the second tab it displayed a "combo1_selected" is undefined.  The script for this event is defined in the user control.

I tried to add this user control to a separate webform and it works fine.

Please help.

Thank you very much,
rei
rei
Top achievements
Rank 1
 answered on 19 Aug 2009
4 answers
117 views
Hi!

I've got a problem with the onclientslide function. What I am trying to do is set the value of the slider in a label. The problem is that the slider and the label are in the PagerTemplate of an gridview.

So when the gridview has only 1 page, the pagertemplate doesn't exist. I can add the javascript function in codebehind and that works fine for a normal page.

But my gridview is in an updatepanel which is in a usercontrol. The first time when the whole page is rendered, the gridview is empty so there is no pagertemplate, after i search the results will be shown in the gridview and the gridview has a pager template. But because it's an async postback, the whole page doesn't render and i cant register javascrip, so the function will not work.

this is my pagertemplate inside the gridview control
<PagerTemplate> 
  <telerik:RadSlider ID="slider" runat="server" Orientation="Horizontal" Skin="Office2007"   
            AutoPostBack="true" OnValueChanged="Slide_Changed" DataValueField="lblpage" OnClientSlide="clientSlide" /> 
  <label>Pagina </label> 
  <asp:Label ID="SlideLabel" runat="server" /> 
  <asp:Label ID="lblpage" runat="server" Text='<%# " van " + ItemsGridView.PageCount %>' /> 
</PagerTemplate> 

This is the function where i try to add the javascript to the slider

protected void ItemsGridView_DataBound(object sender, EventArgs e)  
    {  
      GridViewRow rowPager = ItemsGridView.BottomPagerRow;  
      if (rowPager != null)  
      {  
        RadSlider slider = (RadSlider)rowPager.Cells[0].FindControl("slider");  
        slider.MinimumValue = 1;  
        slider.MaximumValue = ItemsGridView.PageCount;  
        slider.Value = ItemsGridView.PageIndex + 1;  
        Label sliderLabel = (Label)rowPager.Cells[0].FindControl("SlideLabel");  
        sliderLabel.Text = (ItemsGridView.PageIndex + 1).ToString();  
 
          
          
        string script = @"
         <script type='text/javascript'>
           function clientSlide(sender, eventArgs)
          {                
            var myLabel = document.getElementById('" + sliderLabel.ClientID + @"');
            myLabel.innerHTML = sender.get_value();             
          }
        </script>";  
 
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientslider", script);  
        slider.OnClientSlide = "clientSlide";  
      } 
Marlou
Top achievements
Rank 1
 answered on 19 Aug 2009
7 answers
1.8K+ views
OK, this is the css I had for the old styling.  I cannot for the life of me figure out how to properly reference the new classes and the documentation is not current.  I don't really care what skin I use, as long as I can get a handle on getting the references. 

I would appreciate if someone could maybe take what I have here and update it (at least partially) and also let me know how I should reference the style in the Grid control.

 /* TELERIK RAD GRID */  
   
    
.RadGrid_Office2007  
{  
    border:solid 1px #bfbfbf;  
}  
      
.Custom .GridRow_Office2007 td,  
.Custom .GridAltRow_Office2007 td,  
.Custom .GridEditRow_Office2007 td,  
.Custom .GridFooter_Office2007 td,  
.Custom .GridGroupFooter_Office2007 td  
{  
    border:1px #e5e5e5;  
    border-style:none none solid solid;  
    padding-top:4px;  
    padding-bottom:4px;  
}  
 
.Custom .GridRow_Office2007    
{    
    background:none #ffffff;    
    line-height:20px;  
}    
.Custom .GridAltRow_Office2007     
{    
    background:none #f2f2f2;    
    line-height:20px;  
}    
.Custom .GridEditRow_Office2007     
{    
    background:none #ffffe1;    
}    
.Custom .SelectedRow_Office2007     
{    
    background:none #ffffe1;    
     
}    
.Custom .SelectedRow_Office2007 td,  
.Custom .SelectedRow_Office2007>td:first-child  
{  
    border-color:#f2f2f2;  
}  
.Custom .GridRowOver_Office2007   
{    
    background:none #666666;    
}    
 
.Custom .GridPager_Office2007   
{  
    background: #edf5e5;  
      
    color:#333333;  
}  
.Custom .GridPager_Office2007 td  
{  
    border:1px solid #bfbfbf;  
    border-left:0px;  
    border-right:0px;  
    padding:1px 4px 2px;  
}  
 
.Custom .PagerLeft_Office2007  
{  
    padding:5px;  
    float:right;  
}  
.Custom .PagerRight_Office2007  
{  
    padding:5px;  
    float:left;  
}  
.Custom .GridHeader_Office2007  
{  
    color: #666666;  
    font-weight: bold;  
    border-left:1px solid #e5e5e5;  
    border-bottom: solid 1px #e5e5e5;  
    background:none #f2f2f2;  
    padding:5px;  
}  
.Custom .GridHeader_Office2007 a, a:link, a:visited  
{  
    text-decoration:none;  
    font-weight:bold;  
    color:#666666;  
}  
.Custom .GridHeader_Office2007 a:hover, a:active  
{  
    text-decoration:underline;  
    font-weight:bold;  
    color:#666666;  
}  
 
 
.Custom .InnerHeaderStyle_Office2007  a, a:link, a:visited  
{  
    text-decoration:none;  
    font-weight:bold;  
    color:#666666;  
       
}  
.Custom .InnerHeaderStyle_Office2007  a:hover, a:active  
{  
    text-decoration:underline;  
    font-weight:bold;  
    color:#666666;  
}  
 
.Custom .InnerHeaderStyle_Office2007  
{   
    color: #666666;  
    font-weight: bold;  
    border-left:1px solid #e5e5e5;  
    border-bottom: solid 1px #e5e5e5;  
    background:none #f2f2f2;  
    padding:5px;  
}  
 
 
 
.Custom input[type="text"]  
{  
    FONT: 11px Arial, Helvetica, sans-serif;  
    COLOR: #333333;  
    MARGIN: 0px 0px 0px 0px;  
    TEXT-ALIGN: left;  
    BORDER: solid 1px #7f9db9;  
      

The grid reference:
<telerik:RadGrid ID="RadGridCE" runat="server"            
            Skin="Office2007" 
            CssClass="Custom" 
            > 


Thanks!
Dimo
Telerik team
 answered on 19 Aug 2009
1 answer
154 views

I have a scenario when user wolud like to submit all grid's filter criteria at once by pressing Enter or clicking on "Apply Filter" button.
My grid has several FilterTemplates with radcomboboxes and Calendar controls

 function submitFilter() { 
                                    debugger
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>"); 
                                    var combo = $find('<%# ((GridItem)Container).FindControl("radComboBox1").ClientID %>'); 
                                    var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToOrderDatePicker").ClientID %>'); 
                                    var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromOrderDatePicker").ClientID %>'); 
 
                                    var fromDate = FormatSelectedDate(FromPicker); 
                                    var toDate = FormatSelectedDate(ToPicker); 
 
                                    tableView.filter('<%# _fieldName %>', fromDate + " " + toDate, "Between"); 
                                    tableView.filter("PolicyType", combo.get_selectedItem().get_text(), "EqualTo"); 

The problem here is that secont call to filter() function erase all previous filters.

Thanks in advance
Maxim
Yavor
Telerik team
 answered on 19 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?