Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
117 views
Hi.
I try to use RadClientExportManager witch OpenStreetMaps control. When I plot *.gpx file on the map ClientExportManager have a problem with export to pdf or png those lines.
I dont have controls on the map after exoprt too.
See attachat pictures.
Capture1 - oryginal
Capture 2 - exported

Krzysztof

Peter Filipov
Telerik team
 answered on 03 Mar 2015
2 answers
188 views
I am seeing an intermittent problem where users are getting the exception above when RadListView perfoms a DataBind. I am not sure how it can happen, because my code creates a data table and assigns it to the RadListView. Even if it failed to add anything to the data table, it wouldn't cause an exception. Could this be caused by one of the controls in the template?

Here's the stack trace:
ERROR=Cannot perform this operation when DataSource is not assigned. STACK TRACE= 
at Telerik.Web.UI.ListViewNullEnumerable.get_DataSourceCount() 
at Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 
at Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data) 
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) 
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) 
at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.RadListView.PerformSelect() 
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.RadListView.DataBind() 
<my code..>

Here's the HTML:

<telerik:RadListView ID="RadListView1" runat="server" Width="100%" AllowPaging="true" ItemPlaceholderID="StylesHolder" DataKeyNames="StyleNumber" OnPageIndexChanged="RadListView1_PageIndexChanged">
    <LayoutTemplate>
        <fieldset style="width: 100%; border: none;" id="FieldSet1">
            <asp:Panel ID="StylesHolder" runat="server">
            </asp:Panel>
        </fieldset>
    </LayoutTemplate>
    <ItemTemplate>
        <div class="grid_3 SearchResults_Container">
            <a href="#" onclick="DetailClick('<%# Eval("StyleNumber") %>')">
                <%-- This div is necessary in that 'relative' is required in a div before 'absolute' is used in next dic --%>
                <div class="SearchResults_ImageContainer">
                    <%-- This div forces image to be vertical-aligned at bottom, just above text, but centered. --%>
                    <div class="SearchResults_ImageAlignment">
                        <%# GetStylePrimaryImage(Eval("StyleNumber") as string) %>
                    </div>
                </div>
                <%# Eval("StyleNumber") %><br />
                <%# Eval("ProductName") %>
            </a>
        </div>
    </ItemTemplate>
</telerik:RadListView>

The CodeBehind looks like this:
        radListView.DataSource = GetDataTable(strCollectionID, strCollectionName, strDesignerID, strDesignerName, strProductTypeID, strProductTypeName, strRoomID, strRoomName, strSearch);
        radListView.DataBind();
 
...
 
    public DataTable GetDataTable(string strCollectionID, string strCollectionName, string strDesignerID, string strDesignerName, string strProductTypeID, string strProductTypeName, string strRoomID, string strRoomName, string strSearch)
    {
        DataTable dt = new DataTable();
 
(Put some stuff in the table)
 
        return dt;
    }
Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
95 views
I have a simple radgrid (markup below) that is populated with a DataTable, such as the example below;

Flag  Rank
J        3
X       8

In the edit mode I want to change the values of the Rank column, and on update I want the grid to reflect the new value. I don't want to post the value back to the original datasource - I just want it to persist in the radgrid.  In another operation I will use the values in the radgrid after the user makes their edits.

I imagine this is simple to do but I am not seeing it.  Can you point me in the right direction?

protected void rgFlagsToRerank_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    Hashtable newValues = new Hashtable();
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
    int valRank = int.Parse(newValues["Rank"].ToString());
     
    //todo - help please - how do I persist this value in the grid
 
}



<telerik:RadGrid ID="rgFlagsToRerank" runat="server" CellSpacing="0" GridLines="Both" Font-Names="Arial" Font-Size="8pt" Height="400" Width="310px"  AutoGenerateColumns="false" OnCancelCommand="rgTotalVsDissolved_CancelCommand"
                                            OnNeedDataSource="rgFlagsToRerank_NeedDataSource" OnUpdateCommand="rgFlagsToRerank_UpdateCommand" >
                                            <ClientSettings >
                                                <Scrolling AllowScroll="True" UseStaticHeaders="True"  />                                                                                                                                                         
                                            </ClientSettings>
                                            <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"  ></ExportSettings>
                                            <MasterTableView Width="310px" Caption="Flags to Re-rank" EditMode="InPlace" CommandItemDisplay="Top" NoMasterRecordsText="No validation flags to re-rank"
                                                DataKeyNames="ValidationFlags,Rank"
                                                >
                                                <Columns>                                                       
                                                    <telerik:GridBoundColumn DataField="ValidationFlags" UniqueName="ValidationFlags" Display="true" HeaderText="Validation Flag" HeaderStyle-Width="100" ItemStyle-Width="95" ReadOnly="true"  ></telerik:GridBoundColumn>  
                                                    <telerik:GridBoundColumn DataField="Rank" UniqueName="Rank" Display="true" HeaderText="Rank" HeaderStyle-Width="100" ItemStyle-Width="95"   ></telerik:GridBoundColumn>                    
                                                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" HeaderStyle-Width="100px"  UpdateText="Update" CancelText="Cancel"></telerik:GridEditCommandColumn>
                                                </Columns>
                                                <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"  ShowRefreshButton="false"  ></CommandItemSettings>                                       
                                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                                    <HeaderStyle Width="20px" />
                                                </RowIndicatorColumn>
                                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                                    <HeaderStyle Width="20px" />
                                                </ExpandCollapseColumn>
                                                <EditFormSettings>
                                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                    </EditColumn>
                                                </EditFormSettings>
                                            </MasterTableView>
                                            <FilterMenu EnableImageSprites="False"></FilterMenu>
                                        </telerik:RadGrid>



Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
317 views
if I have a row selected (this is done to view and image in a rad window) and then
I hit a column header to sort, the selected index change event is fired
and the previous selected row fires off and shows the image again.

how can I stop this from happening.

Thanks Troy
Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
65 views
See above.
Nencho
Telerik team
 answered on 03 Mar 2015
2 answers
270 views
Hello

I am using a RadComboBox inside a RadGrid.

The RadComboBox is populated by a web service.

The radgrid is being used as a form, where the user can input data to the grid (one row at a time) then click on "insert".

When the user clicks "insert" I need to get access to the value chosen by the user in the RadComboBox.

Below I have put my aspx and then my code-behind for the OnInsert event.

How can I finish my OnInsert event so that I have access to the value chosen by the user in the RadComboBox?


<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" AllowPaging="true"
                    OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateEditColumn="True" OnInsertCommand="RadGrid1_OnInsert" OnItemCreated="RadGrid1_ItemCreated" Width="99%" OnPreRender="RadGrid1_PreRender">
                    <MasterTableView  runat="server" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" EditMode="InPlace" Width="100%" TableLayout="Auto">
                    <Columns>
                         
                      <telerik:GridTemplateColumn UniqueName="UserCol" HeaderText="proto user" DataField="UserID">
                            
                           <EditItemTemplate>
                               <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="false" CausesValidation="true"
                                            Width="240" MaxHeight="200px" OnItemsRequested="ddEmployee_ItemsRequested" AllowCustomText="true"
                                            EnableLoadOnDemand="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                            MarkFirstMatch="false" >
                                </telerik:RadComboBox>
                           </EditItemTemplate>
                       </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="FromFloor" HeaderText="From Floor" UniqueName="FFCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FromStation" HeaderText="From Station" UniqueName="FSCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToFloor" HeaderText="To Floor" UniqueName="TFCol" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ToStation" HeaderText="To Station" UniqueName="TSCol" ></telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="DateToRelocate" HeaderText="Date To Relocate" UniqueName="DateCol" ></telerik:GridDateTimeColumn>
                                         
                    </Columns>
                </MasterTableView>
                </telerik:RadGrid>


protected void RadGrid1_OnInsert(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
 
 
 
 
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager editMan = editedItem.EditManager;
            foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
            {
                if (column is IGridEditableColumn)
                {
                    IGridEditableColumn editableCol = (column as IGridEditableColumn);
                    if (editableCol.IsEditable)
                    {
                        IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                        string editorText = "unknown";
                        object editorValue = null;
 
                        if (editor is GridTemplateColumnEditor)
                        {
 
 
                        }
 
                        if (editor is GridTextColumnEditor)
                        {
                            editorText = (editor as GridTextColumnEditor).Text;
                            editorValue = (editor as GridTextColumnEditor).Text;
                        }
 
 
                    }
                }
            }
 
        }




Dimitar
Telerik team
 answered on 03 Mar 2015
1 answer
160 views
See title.
Nencho
Telerik team
 answered on 03 Mar 2015
1 answer
120 views


Hi,



I’m after some advice please.  My aim is to setup a dynamic sort of roadmap.  Visually this would need to be a grid comprising of twelve columns (represents the next 12 months) and then each activity would exists as a row.

So far I’ve got the grid displaying with the dynamic columns using this simple code:

   DataTable table = new
DataTable();

 

            var startDate = new DateTime(2015, 3, 1);

            var months = Enumerable.Range(0,
11)

                      
.Select(startDate.AddMonths)

                       .Select(m =>
m.ToString("yyyy MMMM"))

                       .ToList();

 

            foreach (string month
in months)

            {

               
table.Columns.Add(month);

            }

 

The next chahlenge was get the rows to appear correctly.  To enable this I created a simple test database table.

I then loop through each row of the tasking table and attempt to match the target_date value with the column date value, if I get a match I insert the data at the correct position

Here is the code I use:

     foreach (DataRow
row in dtroadmapdata.Rows)

            {

               
foreach (DataColumn
col in table.Columns)

               
{

                   
if ((string)row["target_date"] == col.ColumnName)

                   
{

                        DataRow dr = table.NewRow();

                        dr[col.Ordinal] = row["task"];

                        table.Rows.Add(dr);

                   
}

               
}

            }

 

So far so good. However instead of just displaying text I need to insert an image (ideally with an embedded hyperlink)

How can I accomplish this please, tricky because I have no template fields because the columns are creating on the fly.

Any suggestions greatly appreciated.

Konstantin Dikov
Telerik team
 answered on 03 Mar 2015
1 answer
88 views
In my tree, the leaves are the data carriers, but I want a click on a particular node to (visually) select itself and all its descending nodes. I am then using the list of selected nodes in an Ajax request.

But I haven't been able to figure out how to accomplish this.

I started out by selecting all the node's children:

var toSelect = !node.get_selected();

if (toSelect)
                node.select();
            else
                node.unselect();

 children.forEach(function(child) {
                if (toSelect )
                    child.select();                    
                else
                    child.unselect();
            });

This does indeed select all the nodes. The problem though, is that it does not show (they don't turn blue). So I was looking for a way to do this through the Telerik client side API, but failed. So I turned to Jquery:

var tree = $find("rtCustomerGroups");
var nodes = tree.get_nodes();

nodes.forEach(function(node) {
if (node.get_selected())
node.addClass("rtSelected");
else
node.removeClass("rtSelected");

The problem with this approach is that, while it works visually, the browser does not seem to like it - as it's complaining (sometimes) with a typeError saying addClass/removeClass aren't functions.

This also breaks the javascript as the next line, calling the Ajax function, never gets run.

This really bugs me, as the selection really works the way I want, including multi selection with ctrl click.

Bozhidar
Telerik team
 answered on 03 Mar 2015
1 answer
57 views
In my tree, the leaves are the data carriers, but I want a click on a particular node to (visually) select itself and all its descending nodes. I am then using the list of selected nodes in an Ajax request.

But I haven't been able to figure out how to accomplish this.

I started out by selecting all the node's children:

var toSelect = !node.get_selected();

if (toSelect)
                node.select();
            else
                node.unselect();

 children.forEach(function(child) {
                if (toSelect )
                    child.select();                    
                else
                    child.unselect();
            });

This does indeed select all the nodes. The problem though, is that it does not show (they don't turn blue). So I was looking for a way to do this through the Telerik client side API, but failed. So I turned to Jquery:

var tree = $find("rtCustomerGroups");
var nodes = tree.get_nodes();

nodes.forEach(function(node) {
if (node.get_selected())
node.addClass("rtSelected");
else
node.removeClass("rtSelected");

The problem with this approach is that, while it works visually, the browser does not seem to like it - as it's complaining (sometimes) with a typeError saying addClass/removeClass aren't functions.

This also breaks the javascript as the next line, calling the Ajax function, never gets run.

This really bugs me, as the selection really works the way I want, including multi selection with ctrl click.

Bozhidar
Telerik team
 answered on 03 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?