Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
348 views
I have a combobox in a grid popup edit form that I'm creating programatically and I'm trying to set the SelectedIndexChanged event, but I can't seem to get it to fire.

there are some data points that get read in to determine whether or not to set the SelectedIndexChanged event, but here is the code
if (optionType == "ComboBox")
{
    RadComboBox combo = new RadComboBox();
    combo.ID = "dd_" + option.ToString();
    combo.Font.Size = 8;
 
    if (optionName == "Report Date")
    {
        combo.AutoPostBack = true;
        combo.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(dd_RptDate_SelectedIndexChanged);
    }
 
    foreach (var optionValue in q_optionValues)
    {
        combo.Items.Add(new RadComboBoxItem(optionValue.tReportOptionValue.OptNm, optionValue.tReportOptionValue.OptVal));
 
        // if option is Report Date, determine additional controls depending on dropdown value
        if (optionName == "Report Date")
        {
            //if optionvalue is specific date, set the datepickers bool to true
            if (optionValue.tReportOptionValue.OptNm == "Specific Date")
            {
                datepickers = true;
            }
            //if optionvalue is specific months, set the monthpickers bool to true
            if (optionValue.tReportOptionValue.OptNm == "Specific Months")
            {
                //datepickers = true;
            }
        }
    }
 
    panelContent.Controls.Add(combo);
}

I know I'm getting to the point where it should assign the SelectedIndexChanged event because the AutoPostBack attribute right above it is working (I can comment out that line and the combobox doesn't postback).

Here is the associated event code
protected void dd_RptDate_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
    string url = "/";
    Response.Redirect(url);
 
    RadComboBox combo = (RadComboBox)sender;
 
    GridEditFormInsertItem editFormItem = (GridEditFormInsertItem)combo.NamingContainer;
    BuildOptions(editFormItem);
}

I put in the Response.Redirect just to see if the event was firing and it's not.

Am I not going about this correct way? I need to be able to fire off this event so the BuildOptions event gets run when the postback occurs.

Thanks
Helen
Telerik team
 answered on 18 Apr 2011
3 answers
87 views
Hi,

I am using RadScheduler timeline view.
Please find an attached telerik demo screenshot. Is it possible to show a resource title in timeline view?

Thanks,
 
Peter
Telerik team
 answered on 18 Apr 2011
2 answers
57 views
Hello, I am attempting to implement a series of Master / Child RadGrids, similar to the example located:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/selectedvalue/defaultcs.aspx


In fact, I copied most of this code and modified it to work with my database structure.

The problem I have is as follows:

When clicking on a row in Grid #1 to select it, the child Grids #2 and #3 update correctly to reflect the appropriate data associated with Grids #1 and #2, respectively

However, when I use the Next/Previous buttons located in Grid #1 to move between records, only the data in Grid #2 updates. The data in Grid#3 never updates.

The online example posted above exhibits the same behavior. At first I thought that I did something wrong in my program, and have been wracking my brains for a day trying to figure out what I did wrong. Only after I went back to the online example did I see the online example exhibits the same behavior. You can see for yourself... if you go to the example, and click on one of the rows in Grid #1, the data in Grids #2/3 will update... but if you click on the nav buttons in Grid #1, only Grid #2 updates, Grid#3 remains unchanged.

Two questions:

a. Is this a bug in the control, and

b. How can I get Child Grid #3 to update correctly from Grid #2's key value when the user clicks a navigation button on Master Grid #1?
Daniel
Telerik team
 answered on 18 Apr 2011
1 answer
81 views
Hi,

I used grid but I have a method as a class. I bind  datasourse of grid like,
                  
             DataSet dsCategories = null;
                   dsCategories = ct.GetAllCategories();
                    RadGrid2.DataSource = dsCategories;
Problem is paging in the grid. Becouse you suggested to us flowwing using.
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, PostalCode FROM Customers"
            runat="server"></asp:SqlDataSource>

Instead of it, I want to use datasourse for paging or filtering etc.. How I bind it? Thanks.
Pavlina
Telerik team
 answered on 18 Apr 2011
1 answer
113 views
When I edit the grid shows me the following error.

I'm trying to create as many columns as there are data in thedatabase. And the only way I can create the template editing is by using the "autogenerated"

But whenever I have the same problem. I've tried so many ways to fix it but I can not think of anything.


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.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index


Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index]
   System.Web.UI.ControlCollection.get_Item(Int32 index) +8690450
   Telerik.Web.UI.GridTextBoxColumnEditor.LoadControlsFromContainer() +70
   Telerik.Web.UI.GridColumnEditorBase.InitializeFromControl(Control containerControl) +50
   Telerik.Web.UI.GridEditFormItem.InitializeEditorInCell(IGridEditableColumn column) +1083
   Telerik.Web.UI.GridEditManager.GetColumnEditor(IGridEditableColumn column) +175
   Telerik.Web.UI.GridBoundColumn.FillValues(IDictionary newValues, GridEditableItem editableItem) +82
   Telerik.Web.UI.GridEditableItem.ExtractValues(IDictionary newValues) +164
   Telerik.Web.UI.GridEditFormItem.ExtractValues(IDictionary newValues) +169
   Telerik.Web.UI.GridTableView.ExtractValuesFromItem(IDictionary newValues, GridEditableItem editedItem) +115
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +1037
   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +193
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1607
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +802
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +161
   System.Web.UI.Control.EnsureChildControls() +102
   Telerik.Web.UI.GridTableViewBase.get_Controls() +33
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +24
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +148
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +225
   System.Web.UI.Page.LoadAllState() +312
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +747



All columns are inserted from C# code. The reason is that thenumber of columns depends on the number of fields in thedatabase.


protected void uxrdgrid_Deficiencias_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
            DaoDeficiencias servicioDeficiencias = new DaoDeficiencias();
            DaoMetodoRehabilitacion servicioMetodoRehabilitacion = new DaoMetodoRehabilitacion();
            DaoDeficienciaMetodoRehabilitacion servicioDefienciaMetodoRehabilitacion = new         DaoDeficienciaMetodoRehabilitacion();
            DaoTipoValidezMetodoRehabilitacion servicioTipoValidezMetodoRehabilitacion = new DaoTipoValidezMetodoRehabilitacion();
             
            IList listaDeficiencias = servicioDeficiencias.ObtenerTodos();
            IList listaMetodosRehabilitacion = servicioMetodoRehabilitacion.ObtenerTodos();
            IList listaDeficienciaMetodoRehabilitacion = servicioDefienciaMetodoRehabilitacion.ObtenerTodos();
            IList listaTipoValidezMetodoRehabilitacion = servicioTipoValidezMetodoRehabilitacion.ObtenerTodos();
 
            GridTableView tableview = new GridTableView(uxrdgrid_Deficiencias);
            GridColumnCollection coleccionColumnas = new GridColumnCollection(tableview);
            List<ListDictionary> listaDataSource = new List<ListDictionary>();
            GridDropDownColumn column;
             
            DataTable tablaDatos = new DataTable();
            DataColumn columnaDatos;
            DataRow filaDatos;
 
            uxrdgrid_Deficiencias.Columns.Clear();
 
            GridBoundColumn columnBound = new GridBoundColumn();
            columnBound.DataField = "Codigo_deficiencia";
            columnBound.UniqueName = "Codigo_deficiencia";
            columnBound.HeaderText = "Código Deficiencia";
            columnBound.ReadOnly = true;
           
            columnBound.ShowFilterIcon = false;
            columnBound.AllowSorting = true;
            uxrdgrid_Deficiencias.Columns.Add(columnBound);
 
            GridTextBoxColumnEditor GridTextBoxColumnEditor1 = new GridTextBoxColumnEditor();
            GridTextBoxColumnEditor1.ID = "GridTextBoxColumnEditor1";
 
            GridDropDownListColumnEditor GridDropDownListColumnEditor1 = new GridDropDownListColumnEditor();
            GridDropDownListColumnEditor1.ID = "GridDropDownListColumnEditor1";
 
            columnaDatos = new DataColumn();
            columnaDatos.DataType = Type.GetType("System.String");
            columnaDatos.ColumnName = "Codigo_deficiencia";
 
            tablaDatos.Columns.Add(columnaDatos);
 
            foreach (T_METODO_REHABILITACION metodoRehabilitacion in listaMetodosRehabilitacion)
            {
                column = new GridDropDownColumn();
                column.AllowFiltering = false;
                column.DataSourceID = tiposValidezMetodoDataSource.ID;
                column.HeaderText = metodoRehabilitacion.Nombre;
               
                column.DataField = ("Validez." + metodoRehabilitacion.Nombre).Trim();
                column.UniqueName = ("Validez." + metodoRehabilitacion.Nombre).Trim();
                column.ListValueField = "Id";
                column.ListTextField = "Nombre";
 
                uxrdgrid_Deficiencias.Columns.Add(column);
                 
                columnaDatos = new DataColumn();
                columnaDatos.DataType = Type.GetType("System.Int32");
                columnaDatos.ColumnName = ("Validez." + metodoRehabilitacion.Nombre).Trim();
 
                tablaDatos.Columns.Add(columnaDatos);
            }
 
 
            foreach (T_DEFICIENCIA deficienciaItem in listaDeficiencias)
            {
                filaDatos = tablaDatos.NewRow();
                filaDatos["Codigo_deficiencia"] = deficienciaItem.Codigo;
 
                foreach (T_METODO_REHABILITACION metodRehaItem in listaMetodosRehabilitacion)
                {
                    foreach (T_DEFICIENCIA_METODO_REHABILITACION defMetRehItem in listaDeficienciaMetodoRehabilitacion)
                    {
                        if (defMetRehItem.Deficiencia.Id == deficienciaItem.Id && defMetRehItem.MetodoRehabilitacion.Id == metodRehaItem.Id)
                        {
                            filaDatos[("Validez." + defMetRehItem.MetodoRehabilitacion.Nombre).Trim()] = defMetRehItem.Validez.Id;
                        }
                    }
                }
 
                tablaDatos.Rows.Add(filaDatos);
            }
 
            uxrdgrid_Deficiencias.DataSource = tablaDatos;
             
}

And ASPX

       <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function EditRow(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
    </telerik:RadCodeBlock>
 
    <asp:Label ID="Label4" runat="server" CssClass="PageTitle">Métodos de rehabilitación segun deficiencias</asp:Label>
 
    <telerik:RadGrid ID="uxrdgrid_Deficiencias" runat="server" AllowFilteringByColumn="False"
                    AllowSorting="True" AllowPaging="True" PageSize="15" GridLines="None"
                    width="100%" Skin="Vista"
                    AllowAutomaticDeletes="False" AllowAutomaticInserts="False"
                    AllowAutomaticUpdates="False" onneeddatasource="uxrdgrid_Deficiencias_NeedDataSource"
                    ondeletecommand="uxrdgrid_Deficiencias_DeleteCommand"
                    oninsertcommand="uxrdgrid_Deficiencias_InsertCommand"
                    onupdatecommand="uxrdgrid_Deficiencias_UpdateCommand" onitemcommand="uxrdgrid_Deficiencias_ItemCommand">
        <ClientSettings EnableRowHoverStyle="false" AllowKeyboardNavigation="true">
            <Selecting AllowRowSelect="True" />
            <ClientEvents OnRowDblClick="EditRow" />
            <KeyboardNavigationSettings EnableKeyboardShortcuts="true" AllowActiveRowCycle="true" />
        </ClientSettings>
         
        <GroupingSettings  CaseSensitive="false"/>
         
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="Codigo_deficiencia" ClientDataKeyNames="Codigo_deficiencia" EditMode="PopUp" CommandItemDisplay="Bottom">
            <CommandItemSettings AddNewRecordText="Añadir nuevo registro" RefreshText="Refrescar" />
 
            <EditFormSettings InsertCaption="Crear nuevo Detalle de Inspección" CaptionFormatString="Editar Detalle de Inspección: {0}"
            CaptionDataField="Codigo_Deficiencia" EditColumn-CancelText="Cancelar" EditColumn-Display="True" EditFormType="AutoGenerated">
             
                <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
 
                <FormMainTableStyle GridLines="None" CellSpacing="5" CellPadding="3" Width="100%" />
             
                <FormTableStyle CellSpacing="0" CellPadding="2" Height="60px" />
 
                <EditColumn ButtonType="ImageButton"
                    InsertText="Guardar" UpdateText="Guardar cambios"
                    UniqueName="EditCommandColumn1" CancelText="Cancelar edición" >
                </EditColumn>
             
                <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
 
                <PopUpSettings Modal="True" Width=""></PopUpSettings>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
     
<asp:ObjectDataSource ID="tiposValidezMetodoDataSource" runat="server"
    OldValuesParameterFormatString="original_{0}" SelectMethod="ObtenerTodos"
    TypeName="Aquatec.MetresaWeb.Web.DaoServices.DaoTipoValidezMetodoRehabilitacion">
</asp:ObjectDataSource>

Thanks!

Radoslav
Telerik team
 answered on 18 Apr 2011
1 answer
59 views
Hello,

I am using a same grid for the different datasources. I want there non of the row will be double lined. I used  ItemStyle-Wrap="false" but was not useful.
Pavlina
Telerik team
 answered on 18 Apr 2011
1 answer
77 views
Hi,

I am new to telerik controls. It seems really good an I have been evaluating it for use in a project I am working on. The client is really impressed with the look/feel/design. But before I can get him to purchase it I need to be sure I can achieve all the results needed. There is only 1 problem, I am unable to get downloads from a grid working. Below is the code I am using to run the download command. The problem is the choose location dialogue box never appear when I click the download link. I need to mention here that the download link is in a nested grid (grid inside a master grid). Could this be the problem? How do I overcome this?

//Code for inner grid. The event is grid_itemcommand()
void gvReceipt_ItemCommand(object source, GridCommandEventArgs e)
    {
        if (e.CommandName == "Download")
        {
         var ExpHeader_ID = (int)((GridEditableItem)e.Item).GetDataKeyValue("ExpenseHeaderID");
            Int32 ExpID = Convert.ToInt32(ExpHeader_ID);
            ExpHeaderIdReceipt = ExpID;
        
            GridDataItem dataItem = (GridDataItem)e.Item;
            Label lblImgeName = (Label)dataItem.FindControl("lblImage");
            string strRequest = lblImgeName.Text;
            if (!string.IsNullOrEmpty(strRequest))
            {
                string path = Server.MapPath(Manage_FilePaths.HeaderExpImagesRootPath_Original 
+ strRequest);
                System.IO.FileInfo file = new System.IO.FileInfo(path);
                
                if (file.Exists)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                    Response.AddHeader("Content-Length", file.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(file.FullName);
                    Response.End();
                }
                else
                {
                    Response.Write("This file does not exist.");
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.updGrids, typeof(string), "alert", "<script>alert('Please provide a file to download!');</script>", false);
            }
        }
    }
Radoslav
Telerik team
 answered on 18 Apr 2011
5 answers
180 views
Is there a way to change the value of Yaxis major tick labels once the graph is established?

I am passing -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5  for the Y axis.  Client wants all values to show as positive, but respecting the negative position  5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5 on the same Y axis.

Is there a way to step through axis labels and if the value is less than 1, multiply by -1, or just abs() all the ticks?






Evgenia
Telerik team
 answered on 18 Apr 2011
3 answers
55 views
In a hierarchical grid, how can I get the over effect in only master table but NOT in detail table?
The EnableRowHoverStyle gives me the effect both in master and detail table.
Iana Tsolova
Telerik team
 answered on 18 Apr 2011
2 answers
91 views
Hi,
Below code (_doPostBack) is working with explorer but not working with firefox.
Help please.

 <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script language="javascript" type="text/javascript">
            function refreshParent() {
                 __doPostBack('<%=btnSave.UniqueID %>''');
            }
        </script>
 </telerik:RadScriptBlock>

Görkem
Top achievements
Rank 1
 answered on 18 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?