Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
252 views
I use in my application a RadGrid with same Size RadWindow. I use style="width:98%; height:95%; position:absolute"  and            <MasterTableView TableLayout="Auto"></MasterTableView>  in my RadGrid and work fine. But when i try use RadWindowManager
option ShowContentDuringLoad="false" the RadGrid don't show in the first time the same way. Why?
Anybody can help me?
Christiano
Top achievements
Rank 1
 answered on 02 Sep 2010
1 answer
82 views
Hello,

first, I'm new to the Telerik Controls.
So i have downloaded your latest Trial Edition from ASP.NET Web.UI Controls and have tried to make a little sample project with an RadMenu which loads UserControls into an asp:Panel when clicking on the Menuitem. This works fine. So i tried to use your RadGrid Control on a UserControl. Data gets loaded. Now i tried to implement some edit functions to the grid like inserts, updates and deletes.
That was the point where i get in trouble.
First, no update/insert/delete events get raised. Searching your Support Resources i found an hint for this scenario. So i Reload the UserControl in the Page Load Event when it is not loaded. At this point i get the delete event raised. But the update/insert events doesnt get raised. Moving the Reload of the Control to the Page Init Event helps here, the events gets fired, but i can not use the Page Init Event as i need some informations from the viewstate.
What can i do to fix this little problem?

Thx for support
John
Top achievements
Rank 1
 answered on 02 Sep 2010
4 answers
188 views
OK this is a long one to explain. I have a grid that I have a custom column template that has 2 dates under one heading, but each date has to be sortable. So I followed the demo found here: http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/columntypes/defaultcs.aspx 

That part works. The problem comes when I need to export to Excel. I am trying to export on the server side like this:
protected void btnXLS_Click(object sender, EventArgs e)
{
    rgvNextActionDue.ExportSettings.FileName = "NextActionDue";
    rgvNextActionDue.ExportSettings.OpenInNewWindow = true;
    rgvNextActionDue.ExportSettings.ExportOnlyData = true;
    rgvNextActionDue.ExportSettings.IgnorePaging = true;
    rgvNextActionDue.ExportSettings.Excel.FileExtension = "xls";
    rgvNextActionDue.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
    rgvNextActionDue.MasterTableView.ExportToExcel();
}

It exports fine, but when I try to open it I get an error that says "unknown" check some temporary file at C:\Documents and Settings\username\Local Settings\Temporary Internet Files\Content.MSO\SomeRandomNamedErrorFile.txt

I checked the randomly named error file and it says:
XML PARSE ERROR:  Missing end-tag
  Error occurs at or below this element stack:
    <div>
     <span>
      <table>
       <tr>
        <td>
         <nobr>

and that's it.

It took me forever to figure out that it was the buttons that let me sort the custom column that were causing the error in the first place. So I tried a couple things and finally got it to export to excel by exporting it like this:
protected void btnXLS_Click(object sender, EventArgs e)
{
    rgvNextActionDue.ExportSettings.FileName = "NextActionDue";
    rgvNextActionDue.ExportSettings.OpenInNewWindow = true;
    rgvNextActionDue.ExportSettings.ExportOnlyData = true;
    rgvNextActionDue.ExportSettings.IgnorePaging = true;
    rgvNextActionDue.ExportSettings.Excel.FileExtension = "xls";
    rgvNextActionDue.ExportSettings.Excel.Format = GridExcelExportFormat.Html;
    rgvNextActionDue.MasterTableView.ExportToExcel();
}
for some reason it didn't like exporting the buttons using ExcelML as the format. I have no problem with exporting it as HTML, but now
the problem is that the exported excel file has the headers of the custom column backwards.

For example,
The grid has:
Period
    Start Date - End Date

The excel file has:

row1 :         Period
row2 :               -
row3:       End Date   Start Date

(obviously I added the rows as reference to which excel row they show up in)

If it helps I have the column set up like this in the aspx file:
<tlk:GridTemplateColumn UniqueName="PeriodTemplate" Groupable="false">
  <HeaderTemplate>
    <table id="tblPeriod" cellspacing="0" width="100%">
      <tr>
        <td colspan="3" align="center">
          <b>Period</b>
        </td>
      </tr>
      <tr>
        <td style="width:49%" align="center">
          <asp:LinkButton CssClass="Button" ID="btnPStart" Text="Start"
              ToolTip="Sort by Period Start" CommandName="Sort"
              CommandArgument="EvFYStart" runat="server" />
        </td>
        <td align="center" style="width:1%">-</td>
        <td style="width:50%" align="center">
          <asp:LinkButton CssClass="Button" ID="btnPEnd" Text="End"
             ToolTip="Sort by Period End" CommandName="Sort"
             CommandArgument="EvFYEnd" runat="server" />
        </td>
      </tr>
    </table>
  </HeaderTemplate>
  <HeaderStyle Width="120px" />
  <ItemTemplate>                                       
    <table cellspacing="0" width="100%" border="0">
      <tr>
        <td style="width:49%; border:0;" align="center">
           <%# Eval("EvFYStart") %>
        </td>
        <td align="center" style="width:1%; border:0;">-</td>
        <td style="width:50%; border:0;" align="center">
          <%# Eval("EvFYEnd") %>
        </td>
      </tr>
    </table>
  </ItemTemplate>
  <ItemStyle HorizontalAlign="Center" />
</tlk:GridTemplateColumn>

So if anyone has any idea of how to fix this I would appreciate any help you could provide.

Thanks,

Dustin
Dustin Dodson
Top achievements
Rank 1
 answered on 02 Sep 2010
2 answers
109 views
Hi I'm using JSON for recovery data from the WebMethod but I wanna add telerik:rowbound for each item in the list...

The grid is empty, no have neither columns and rows, I assign the columns on the pageload, then recovery the data on the cliente side and I add rows to the grid for javascript something like this:
 
function CargarParametrosSuccess(resultado) {
          var parametros = (typeof resultado.d) == 'string' ?
                               eval('(' + resultado.d + ')') :
                               resultado.d;
  
          for (var i = 0; i < parametros.length; i++) {
              //TODO: crear Fila en grid 
              var parametro = parametros[i];
  
              var tabla = document.getElementById("rgvParametros_ctl00");
              var fila = tabla.insertRow();
  
              var celda = fila.insertCell();
              var newImage = document.createElement('input');
              newImage.type = 'image';
              newImage.src = 'Imagenes/seleccionar.png';
              celda.width = 20;
              celda.appendChild(newImage);
  
              celda = fila.insertCell();
              celda.width = 80;
              celda.innerHTML = parametro.Codigo;
  
              celda = fila.insertCell();
              celda.innerHTML = parametro.Nombre;
  
              celda = fila.insertCell();
              celda.innerHTML = parametro.Descripcion;
  
              celda = fila.insertCell();
              celda.innerHTML = parametro.Valor;
  
              celda = fila.insertCell();
              celda.innerHTML = parametro.Estado;   
          }}

 But the rows is added under the pagination buttons...

Thanks a lot for your responses.

Pedro
Top achievements
Rank 1
 answered on 02 Sep 2010
2 answers
364 views
I hope I'm not too vague here and I'll be happy to post a project or just explain a bit better if required.

I have a simple grid with two columns. I am databinding the grid with NeedsDataSource, dynamically creating a DataTable in code-behind from a business object. I am trying to completely avoid using ObjectDataSources.  In short:

Column1 = Entity.EmailAddress (example: abc@def.com)
Column2 = Entity.EmailAddressType.Description

EmailAddressType is an object of EmailAddressType with properties ID and Description. (example: hm=Home)

The grid simply allows someone to enter a number of email addresses, and what they're for: Home, Work, School, etc., with the type limited to a provided selection.

The ItemTemplate for column2 renders "Home". The EditItemTemplate presents a RadComboBox, also generated at runtime, with all EmailAddressTypes loaded with Value=type.ID and Text=type.Description.

At runtime, I can elect to Insert or Update, and the ComboBox renders the list. Everything looks good until changes are submitted.

The problem is that when I change the data and click Update, the RadGrid ItemUpdated event is fired, but only the first column with the address is available in the event e.Item.  I thought the selected value from the second column EditItemTemplate would be available there too.

I don't think I'm properly defining the RadComboBox within the EditItemTemplate.  Do I need to check the combobox itself to get the value?  (Not sure it's available when ItemUpdated fires)  How do I ensure that the value of the combobox is associated with the cells in the row being changed so that when postback events are fired the selected value comes back with all other data?  (I haven't tried but I suspect I'm going to have the same problem with other controls, so what I learn here will be very helpful for subsequent work.

As to why I want to avoid ObjectDataSource: It's just too flaky, not powerful enough, always leaving something to be desired somewhere between markup and codebehind. Read notes by Nikhil Khotari, Manuel Abadia, and many others. So I'm trying to get some practice doing everything programmatically, and unfortunately sacrificing some of the designer benefits of binding to a datasource at design time.

Thanks!
TonyG
Top achievements
Rank 1
 answered on 02 Sep 2010
2 answers
198 views
I have a RadGrid where i need to change the css style for a row for all selected items when a certain button is clicked (client-side)

The style for the row is originally set in ItemDataBound:

If

 

 

dataItem("Printed").Text = "False" Then

 

e.Item.CssClass =

 

"rgRow unViewedEval"

 

 

 

End If

 


I want to change the cssclass for the row to "rgRow viewedEval" once a button is clicked
The button triggers the javascript below:

function

 

 

GetSelectedItems(theGrid) {

 

 

 

var grid = $find(theGrid);

 

 

 

if (grid) {

 

 

 

var MasterTable = grid.get_masterTableView();

 

 

 

var selectedRows = MasterTable.get_selectedItems();

 

 

 

for (var i = 0; i < selectedRows.length; i++) {

 

 

 

var row = selectedRows[i];

 

row.className =

 

'rgRow viewedEval';

 

}

}

}

How do I access the style for each row? Obviously "row.className = " is not it.

Richard Boarman
Top achievements
Rank 1
 answered on 02 Sep 2010
3 answers
124 views
Greetings,

I am getting "Error: Object expected" when creating a new RadTab. Any ideas what could be causing this? It makes no sense to me, and it only happens when the script resides in a RadWindow.

function openingNewWindow(oWnd, title) {
    if (oWnd) {
        tabStrip.trackChanges();
        //create a new tab
        var tab = new Telerik.Web.UI.RadTab();
        //set the text of the tab
        tab.set_text(title);
        oWnd.correspondingTab = tab;
        //add the tab to the tabstrip
        tabStrip.get_tabs().add(tab);
        tabStrip.repaint();
        tab.correspondingWnd = oWnd;
        tab.set_imageUrl("../CSS/titlegraphic.gif");
        tabStrip.commitChanges();
        //Select this tab
        tab.select();
    }
}


Regards,
Tom
Yana
Telerik team
 answered on 02 Sep 2010
1 answer
233 views

Hi
I just downloaded trial version and was trying to bind data to the Grid and got this error.

Error 2 Unable to copy file "..\..\..\..\..\..\..\Program Files\Telerik\RadControls for ASP.NET AJAX Q2 2010\Bin20\Telerik.Web.UI.dll" to "bin\Telerik.Web.UI.dll". The process cannot access the file 'bin\Telerik.Web.UI.dll' because it is being used by another process. 

Thank you
Neetah
Maria Ilieva
Telerik team
 answered on 02 Sep 2010
1 answer
398 views

 

I have Radgrid in which I am showing the data.

whenever there is a postback I am showing a loding panel with the help of
RadAjaxManager and RadAjaxLoadingPanel.

There is a facility to filter the Grid. After applying the filters, if there are no records for the filter criteria, I am making the Grid visible false. but after that if I apply new filter and make a postback, it throws the following error. As long as there are records in Grid and it is visible, I can apply filters and it works fine. But if there are no records for the filter criteria and I hide the Grid, it does not work for the next time even if I make the Grid Visble true. It throws the following exception. Please suggest.

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 


My code is as below.

protected void Page_Load(object sender, EventArgs e)
        {
              
            pnlError.Visible = false;
            setControlsVisibility(true);
              
        }
  
 protected void btnFilterResults_Click1(object sender, ImageClickEventArgs e)
        {
            FilterGrid();
        }
  
void FilterGrid()
        {
            IsTopCommandCreated = false;
  
            // Sites = All, ToDate & FromDate are selected
            if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = All, ToDate = selected, FromDate = NULL
            else if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\')";
            }
            // Sites = All, ToDate = NULL, FromDate = selected
            else if (RadComboBoxSites.SelectedIndex == 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')";
            }
            // Sites = Specific Site, ToDate & FromDate are selected
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate = selected, FromDate = NULL
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate = NULL, FromDate = selected
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                RadGrid1.MasterTableView.FilterExpression = "(([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\') "
                                                            + " AND " + "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\'))";
            }
            // Sites = Specific Site, ToDate & FromDate are NULL
            else if (RadComboBoxSites.SelectedIndex != 0 && ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate == null)
            {
                RadGrid1.MasterTableView.FilterExpression = "([SiteName] LIKE \'%" + RadComboBoxSites.SelectedItem.Text + "%\')";
            }
            // Otherwise display open invoices for all regional sites.
            else
            {
                RadGrid1.MasterTableView.FilterExpression = "";
            }
  
            GridColumn columnSite = RadGrid1.MasterTableView.GetColumnSafe("SiteName");
            GridColumn columnDateDue = RadGrid1.MasterTableView.GetColumnSafe("DateDue");
  
            // Sites = Specific Site
            if (RadComboBoxSites.SelectedIndex != 0)
            {
                columnSite.CurrentFilterFunction = GridKnownFunction.Contains;
                columnSite.CurrentFilterValue = RadComboBoxSites.SelectedItem.Text;
            }
  
            // ToDate & FromDate are selected
            if (ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate != null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.Between;
                columnDateDue.CurrentFilterValue = "(([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')"
                                                    + " AND " + "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\'))";
            }
            // ToDate = selected, FromDate = NULL
            else if (ToDatePicker.SelectedDate != null && FromDatePicker.SelectedDate == null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.LessThanOrEqualTo;
                columnDateDue.CurrentFilterValue = "([DateDue] <= \'" + ToDatePicker.SelectedDate.ToString() + "\')";
            }
            // ToDate = NULL, FromDate = selected
            else if (ToDatePicker.SelectedDate == null && FromDatePicker.SelectedDate != null)
            {
                columnDateDue.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
                columnDateDue.CurrentFilterValue = "([DateDue] >= \'" + FromDatePicker.SelectedDate.ToString() + "\')";
            }
  
            RadGrid1.DataSourceID = "InvoiceDataSource";
            RadGrid1.MasterTableView.Rebind();  
        }
  
        /// <summary>
        /// Set the visibility of the main datatable, the filtering and the forwardtoColleague sections
        /// </summary>
        /// <param name="visibility"></param>
        void setControlsVisibility(bool visibility)
        {
            var controls = new Control[] { RadGrid1, pnlFilter, ForwardToColleagueMain };
            foreach (var c in controls)
            {
                if (c != null)
                {
                    c.Visible = visibility;
                }
            }
        }

Maria Ilieva
Telerik team
 answered on 02 Sep 2010
2 answers
162 views
Hello,

I want to popup two different radalerts on my page depending on specific server side events.  However, I want a different image (by image I am referring to the yellow exclamation mark that the default radalert shows at the left of the text) to appear in each one of them.  For example, I want a checkmark on one and an exclamation mark on the other.

How can I accomplish this?? I have already made the radalert popup to work successfully, I only need to do the image thing.

Thank you in advance,
Manuel
sravanthi
Top achievements
Rank 1
 answered on 02 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?