Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
84 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
260 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
51 views
See above.
Nencho
Telerik team
 answered on 03 Mar 2015
2 answers
250 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
139 views
See title.
Nencho
Telerik team
 answered on 03 Mar 2015
1 answer
104 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
68 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
38 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
96 views
Hi there,

We have a problem with the strong password check of the radTextBox.
In our changepassword screen the strong password indicator isn't working. This means of course that new users of our product cannot change their initial password since we require at least a strong password.

Next our administrator goes to her usermanagement screen (which also contains a radTextBox with Passwordstrength settings enabled) and changes the password of this user.  The indicator ís working here. (Note: she does this on her own machine, not the user's).

The user now tries to change her password again. Now, all of a sudden the user does see the passwordstrength indicator. What's more, so does everyone else who tries to change his of her password.

It feels as if sometimes the server doesn't load javascripts to the browser, but once it has loaded the script, it keeps doing it.

We see this behaviour since we upgraded to the Telerik 2014 Q3 controls, version 2014.3.1024.45.

We don't have a clue what is going on here, but we do get a lot of support questions now. Anyone any idea what's going on here?







Dimitar
Telerik team
 answered on 03 Mar 2015
1 answer
139 views
for example:
<!DOCTYPE html">
<head runat="server">
<script type="text/javascript">
function pageLoad()
{
    $find("DropDownList").get_items().removeAt(0);
}
</script>
</head>
<body>
<form runat="server">
<Telerik:RadScriptManager runat=server />
<Telerik:RadDropDownList runat=server ID=DropDownList>
    <Items>
        <Telerik:DropDownListItem Text=1 />
        <Telerik:DropDownListItem Text=2 Selected />
        <Telerik:DropDownListItem Text=3 />
    </Items>
</Telerik:RadDropDownList>
</form>
</body>
</html>
Open the page above, then select the item "3", It will cause that the item "2" will not able to select.
The Version of my RadControl is "2014 Q1"
Bozhidar
Telerik team
 answered on 03 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?