Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
132 views
Unable to cast object of type 'System.DBNull' to type 'Telerik.Web.UI.RadTimeView'.

i got that error
Shinu
Top achievements
Rank 2
 answered on 17 Jun 2010
5 answers
205 views
Hello,

A brief explanation of what I want to do:
I'm using a Custom AdvanceEditTemplate to update employee absences. For this I need a RadGrid inside the advanceform to show absence details. Until now no problems. I'm able to populate the grid with data through a SQLDataSource. This grid records must be editable and there is where the problems start as I can't figure how to access the RadGrid (RadGrid3) update line that is nested in the AdvancedEditTemplate. In this radgrid I must have a UploadFile control to save an attachment (to filesystem) and a textbox to update a "Reason" property. I need to update this record in the absence table through an SQLDataSource which will call an SP to update these two collumns (attachment link and reason). For this I'm using the Grids UpdateCommand
event as shown below:


CodeBehind:
protected void RadGrid3_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            //Insert Record in Portal Absence Tables for a Update Action
            //Properties: Reason, Attachment, Action(UPDATE),Status(1)
            GridEditableItem editedItem = e.Item as GridEditableItem;
            

            Session["lResourceAbsenceDetailID"] = editedItem["lResourceAbsenceDetailID"].Text;
            Session["Reason"] = "";
            Session["Status"] = 1;
            Session["Action"] = "UPDATE";
            Session["Attachment"] = attachment;
            SqlDataSource5.Select(DataSourceSelectArguments.Empty);
        }




ASPNET COde:
    <telerik:RadScheduler ID="RadScheduler1" OnClientAppointmentDoubleClick="OnClientAppointmentDoubleClick"
        runat="server" SelectedView="MonthView" TimelineView-UserSelectable="false" WeekView-UserSelectable="true"
        GroupingDirection="Vertical" OverflowBehavior="Expand" Skin="Outlook" DataSourceID="SqlDataSource1"
        TimelineView-HeaderDateFormat="mm-yy" StartInsertingInAdvancedForm="True" TimelineView-ColumnHeaderDateFormat="dd"
        OnAppointmentClick="RadScheduler1_AppointmentClick" OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
        OnFormCreating="RadScheduler1_FormCreating" OnFormCreated="RadScheduler1_FormCreated"
        OnAppointmentCommand="RadScheduler1_AppointmentCommand" DataEndField="EndDate"
        DataKeyField="lResourceAbsenceID" DataStartField="StartDate" DataSubjectField="Name"
        MonthView-AdaptiveRowHeight="true" OnClientAppointmentDeleting="OnClientAppointmentDeleting">
        <Localization ConfirmDeleteText="Tem a certeza que pretende eliminar esta ausência?"
            ConfirmDeleteTitle="Confirmar Eliminação" />
        <AdvancedForm Modal="true" />
        <MonthView AdaptiveRowHeight="True" />
        <AdvancedEditTemplate>
            <div class="rsAdvancedEdit" style="position: relative">
                <%-- Title bar. --%>
                <div class="rsAdvTitle">
                    <%-- The rsAdvInnerTitle element is used as a drag handle when the form is modal. --%>
                    <h1 class="rsAdvInnerTitle">
                    </h1>
                    <asp:LinkButton ID="AdvancedEditCloseButton" runat="server" CausesValidation="false"
                        CommandName="Cancel" CssClass="rsAdvEditClose" ToolTip="close"> close
                    </asp:LinkButton>
                </div>
                <div class="rsAdvContentWrapper">
                    <telerik:RadGrid ID="RadGrid3" runat="server" AutoGenerateEditColumn="True" DataSourceID="SqlDataSource9"
                        GridLines="None" OnUpdateCommand="RadGrid3_UpdateCommand" Skin="Outlook" ClientSettings-Selecting-AllowRowSelect="true">
                        <MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource9">
                            <RowIndicatorColumn>
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn>
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="AbsenceID" DataType="System.Int32" HeaderText="AbsenceID"
                                    ReadOnly="True" SortExpression="AbsenceID" UniqueName="AbsenceID" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridDropDownColumn DataField="AbsenceCodeID" DataSourceID="SqlDataSource8"
                                    HeaderText="Tipo Ausencia" ListTextField="Name" ListValueField="AbsenceID" ReadOnly="True"
                                    SortExpression="AbsenceCodeID" UniqueName="AbsenceCodeID">
                                </telerik:GridDropDownColumn>
                                <telerik:GridBoundColumn DataField="lResourceAbsenceDetailID" DataType="System.Int32"
                                    HeaderText="lResourceAbsenceDetailID" ReadOnly="True" SortExpression="lResourceAbsenceDetailID"
                                    UniqueName="lResourceAbsenceDetailID" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="lResourceAbsenceID" DataType="System.Int32" HeaderText="lResourceAbsenceID"
                                    ReadOnly="True" SortExpression="lResourceAbsenceID" UniqueName="lResourceAbsenceID"
                                    Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ResourceID" DataType="System.Int32" HeaderText="ResourceID"
                                    ReadOnly="True" SortExpression="ResourceID" UniqueName="ResourceID" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Hours" DataType="System.Int64" HeaderText="Hours"
                                    ReadOnly="True" SortExpression="Hours" UniqueName="Hours" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ScheduleDetailID" DataType="System.Int32" HeaderText="ScheduleDetailID"
                                    ReadOnly="True" SortExpression="ScheduleDetailID" UniqueName="ScheduleDetailID"
                                    Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="starttime" DataType="System.TimeSpan" HeaderText="Hora Inicio"
                                    ReadOnly="True" SortExpression="starttime" UniqueName="starttime">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="endtime" DataType="System.TimeSpan" HeaderText="Hora Fim"
                                    ReadOnly="True" SortExpression="endtime" UniqueName="endtime">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Date" DataType="System.DateTime" HeaderText="Data"
                                    ReadOnly="True" SortExpression="Date" UniqueName="Date">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Reason" HeaderText="Motivo" UniqueName="Reason">
                                </telerik:GridBoundColumn>
                                <telerik:GridAttachmentColumn FileNameTextField="Attachment" HeaderText="Anexo" UniqueName="Attachment">
                                </telerik:GridAttachmentColumn>
                                <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" />
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
                    <br />
                    <div>
                        <asp:ImageButton ID="btn_AllUsers" runat="server" ImageUrl="~/images/delete.gif"
                            CommandName="DeleteAbsence" />
                        <asp:LinkButton ID="lBtn_DeleteAbsence" Text="Eliminar Tudo" CssClass="SubHead" runat="server"
                            CommandName="DeleteAbsence_" />
                        <br />
                        <asp:Label ID="pl_DeleteRequestMessage" CssClass="SuccessMessage" runat="server"
                            Visible="false" />
                    </div>
                    <asp:Panel ID="ButtonsPanel" runat="server" CssClass="rsAdvancedSubmitArea">
                        <div class="rsAdvButtonWrapper">
                            <%--<asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" CssClass="rsAdvEditSave"> <span>Salvar</span>
                            </asp:LinkButton>--%>
                            <asp:LinkButton ID="CancelButton" runat="server" CausesValidation="false" CommandName="Cancel"
                                CssClass="rsAdvEditCancel"> <span>VOLTAR</span>
                            </asp:LinkButton>
                        </div>
                    </asp:Panel>
                </div>
            </div>
        </AdvancedEditTemplate>


....but it's not working as I can't get the Grid row that I'm updating through (editedItem["lResourceAbsenceDetailID"].Text;). Another problem is that I'm not able to debug this. Can someone please tell me what I must do to make this work. I would very much apreciate any help.

Cheers,
Pedro



Peter
Telerik team
 answered on 17 Jun 2010
1 answer
69 views
Hi Team,

Changing SpecialDays style or templateID are well documented, but could you explain how to change SpecialDays item content adding extra markups or some content at runtime server side (client side only get)coded?. I searching to add more information inside the item.
Exist others ways to add contents in normal items(not special days) near date?.

Thanks for your tip. Romi
Maria Ilieva
Telerik team
 answered on 17 Jun 2010
6 answers
206 views
RadEditor lite deployed and activated on my wss 3.0 site but not showing as default list editor; wss standard editor shows instead. I've checked several threads online and I believe I've deployed the solution correctly and both the 

Use RadEditor to edit List Items

and 

Use RadEditor to edit List Items in Internet Explorer as well

site features showing as activated on the site settings. I've done an iisreset 3 times now; no luck.

I was wondering about pre-reqs. Is ajax required for the lite editor?

Anything else obvious I may be missing that I can check?

Many thanx in advance!!
catherineball
Top achievements
Rank 1
 answered on 17 Jun 2010
5 answers
401 views
I'm using a FileExplorer that displays image files.  When the user selects a file I need to postback to do some logic.  So I have the following function wired up to the OnClientItemSelected event.

        function OnClientItemSelected(sender, args) 
        { 
            var imageSrc = args.get_path(); 
 
            if (imageSrc.match(/\.(gif|jpg|png)$/gi)) 
            { 
                var filename = imageSrc.substring(imageSrc.lastIndexOf('/') + 1); 
                __doPostBack("rfeCharts", filename); 
            } 
        } 

After the postback, the file is no longer selected in the control.  I've tried reselecting the file on the server side with .InitialPath and on the client side using the following:
        function OnClientLoad(oExplorer, args) 
        { 
            var hdChartID = $get("<%=hdChartID.ClientID %>"); 
            var oGrid = oExplorer.get_grid(); 
            var dataRows = oGrid.MasterTableView.get_dataItems(); 
             
            for(var i = 0; i < dataRows.length; i++) 
            { 
                if(dataRows[i].get_dataItem()) 
                { 
                    if(dataRows[i].get_dataItem().Name == hdChartID.value) 
                        oGrid.MasterTableView.selectItem(oGrid.MasterTableView.get_dataItems()[i].get_element()); 
                } 
            } 
        } 

And these methods both fire the OnClientItemSelected event again which causes an infinite postback loop.

So how can I persist the selected item through a postback?  Or is there another suggestion?




Fiko
Telerik team
 answered on 17 Jun 2010
8 answers
324 views
I am trying to use the self-referencing hierarchy functionality of the grid but can't seem to get it to work properly. I even tried copying the code directly from the tutorial specified here verbatim into a new page and I continually get the same error: "No property or field 'ParentID' exists in type 'DataRowView'."

My application has the following grid definition:

    <telerik:RadGrid ID="RadGrid2" runat="server" Skin="" Width= "97%" OnNeedDataSource= "RadGrid2_NeedDataSource" GridLines="None" ShowHeader="False">  
        <MasterTableView HierarchyDefaultExpanded="True" HierarchyLoadMode="Client" DataKeyNames= "NETT_ID,NETT_IS_ID" Width="100%" AutoGenerateColumns="False">  
        <SelfHierarchySettings ParentKeyName="NETT_IS_ID" KeyName="NETT_ID" MaximumDepth="0" /> 
        <Columns> 
            <telerik:GridBoundColumn HeaderText="NETT_ID" DataField="NETT_ID" /> 
            <telerik:GridBoundColumn HeaderText="NETT_IS_ID" DataField="NETT_IS_ID" /> 
            <telerik:GridBoundColumn HeaderText="Intermediate Stock" DataField="NETT_PRODUCT" /> 
        </Columns> 
    </MasterTableView> 
</telerik:RadGrid>  

When I run it against my data source, the grid binds great and even has the hierarchy as I would expect with one exception - ALL records are displayed as if they are parent records in addition to the one record that should be a parent record (which has all records again as children). I need to get rid of all the "top elements" with the exception of the one that is really supposed to be the parent. In the future multiple top-level parent elements will exist (all with a NETT_IS_ID value of 0), but currently only one does.

I tried using FilterExpressions, but even when I use the sample code provided from the Knowledge Base, it doesn't run. It just tells me the column NETT_IS_ID doesn't exist in the dataview, even though I can bind to it directly and it does in fact exist.

In case it helps, here is my code-behind:
        protected void Page_Load(object sender, EventArgs e)  
        {  
            site mstr = (site)this.Master;  
            mstr.PageHeader = "Intermediate Stock";  
 
            this.PreRenderComplete += new EventHandler(Page_PreRenderComplete);  
            //this.BindData();  
        }  
 
        DataTable BindData()  
        {  
 
            DataSet ds = new DataSet();  
 
            using (OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["IntermediateStock"].ConnectionString))  
            {  
 
                using (OracleCommand cm = new OracleCommand())  
                {  
 
                    cm.Connection = conn;  
                    cm.CommandText = "IS_NETT.GET_PRODUCT_TREE";  
                    cm.CommandType = CommandType.StoredProcedure;  
 
                    OracleParameter param = new OracleParameter();  
                    param.Direction = ParameterDirection.Output;  
                    param.ParameterName = "IO_CURSOR";  
                    param.OracleType = OracleType.Cursor;  
 
                    cm.Parameters.Add(param);  
 
                    using (OracleDataAdapter da = new OracleDataAdapter(cm))  
                    {  
                        //da.TableMappings.Add("Table", "ISResults");  
                        da.Fill(ds, "Table");  
                    }  
 
                }  
 
            }  
 
            DataColumn[] keys = new DataColumn[1];  
            keys[0] = ds.Tables[0].Columns["NETT_ID"];  
 
            ds.Tables[0].PrimaryKey = keys;  
 
            return ds.Tables[0];  
 
        }  
 
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)  
        {  
            this.RadGrid1.DataSource = this.BindData();  
        }  
 
        protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)  
        {  
            this.RadGrid2.DataSource = this.BindData();  
        }  
 
        public void Page_PreRenderComplete(object sender, EventArgs e)  
        {  
            HideExpandColumnRecursive(RadGrid1.MasterTableView);  
            HideExpandColumnRecursive(RadGrid2.MasterTableView);  
        }  
        public void HideExpandColumnRecursive(GridTableView tableView)  
        {  
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);  
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)  
            {  
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)  
                {  
                    if (nestedView.Items.Count == 0)  
                    {  
                        TableCell cell = nestedView.ParentItem["ExpandColumn"];  
                        cell.Controls[0].Visible = false;  
                        nestedViewItem.Visible = false;  
                    }  
                    if (nestedView.HasDetailTables)  
                    {  
                        HideExpandColumnRecursive(nestedView);  
                    }  
                }  
            }  
        }   
    }  
}  
 

Any suggestions?
Yavor
Telerik team
 answered on 17 Jun 2010
10 answers
429 views
hi

I have this GridView code and i have tried using this in Radgrid. it seems not working.

how do i convert this Gridview code to be used in Radgrid. Thanks

public class GridDecorator
{
    public static void MergeRows(GridView gridView)
    {
        for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--)
        {
            GridViewRow row = gridView.Rows[rowIndex];
            GridViewRow previousRow = gridView.Rows[rowIndex + 1];

            for (int i = 0; i < row.Cells.Count; i++)
            {
                if (row.Cells[i].Text == previousRow.Cells[i].Text)
                {
                    row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1;
                    previousRow.Cells[i].Visible = false;
                }
            }
        }
    }
}


protected void gridView_PreRender(object sender, EventArgs e)
{
    GridDecorator.MergeRows(gridView);
}
nisha
Top achievements
Rank 1
 answered on 17 Jun 2010
1 answer
134 views
Hi!
I am not able to change the Rad Editor's default font-family in Edit Mode. It is always Times New Roman. I have found some help on this suggesting to change the style in the EditorContentArea.css of the Default Skin. But those articles seem to refer to another Version of the Rad Editor, as I cannot find a "Skins" folder for my installation, there is none in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources\RadEditorSharePoint\5.7.2.0__1f131a624888eeed . I am using the full version (5.7.2.0) on a MOSS 2007 installation.
Thanks a lot for your help
Tatjana
Rumen
Telerik team
 answered on 17 Jun 2010
1 answer
87 views
Hi.
I recently upgraded my website from .NET 2.0 to 3.5 and everything seems to work fine (after I added the 3.5 version of Telerik.dll into my bin-folder).

But, my Scheduler does not respond to any left-click (i.e. trying to change date, add an event), and the only way to interact with the scheduler is to right-click in order to get the dropdown-menu. However, it is still not possible to right-click any of the menu-items (i.e. add new appointment).

Have I forgotten anything?

Looking forward to your replies.
Best regards,
Royend
Peter
Telerik team
 answered on 17 Jun 2010
1 answer
180 views
Hello

I am attempting to access the index of a row selected in a radGrid using itemIndexHierarchical, however I am getting an incorrect index in certain cases.

I am binding my data on the client using set_dataSource(json) and dataBind().  If there are no rows when the grid is first populated, then I add one (or several) by adding an item to my json, then doing set_dataSource and dataBind(), then call itemIndexHierarchical(), the index that gets returned is 1 higher than it should be.

Any workaround to this (other than counting the number of items in the grid before I do anything, if there are 0, then subtract 1 from the value I get back from itemIndexHierarchical())?
Nikolay Rusev
Telerik team
 answered on 17 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?