Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
546 views
I have a column defined as:
<telerik:GridCheckBoxColumn ConvertEmptyStringToNull="False"
    FilterControlAltText="Filter checked column" SortExpression="Checked"
    UniqueName="Checked" DataField="Checked" HeaderText="Remove" ToolTip="Check this box to remove this item from your cart" DataType="System.Boolean">
    <HeaderStyle Wrap="False" HorizontalAlign="Left" Width="80px" CssClass="grid-header grid-header-first" />
    <ItemStyle HorizontalAlign="Center" Width="100%" VerticalAlign="Top" />
</telerik:GridCheckBoxColumn>

This column is the only edit-able field in the grid, the rest are bound columns marked as ReadOnly.  The grid always has all rows in edit mode using the following:
protected void grdItems_PreRender(object sender, EventArgs e)
{
    try
    {
        foreach (GridDataItem colGridField in grdItems.MasterTableView.Items)
            colGridField.Edit = true;
 
        grdItems.Rebind();
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.Print("Error: " + ex.ToString());
        Exceptions.ProcessModuleLoadException(this, ex);
    }
}

I have a button which needs to look at each row's check box and remove any items that are checked (perfromed by the CleanUpData method).  The button's click handler is:
protected void btnUpdateCart_Click(object sender, EventArgs e)
{
    try
    {
        //grdItems.MasterTableView.Items[grdItems.MasterTableView.Items.Count - 1].FireCommandEvent("UpdateAll", string.Empty);
        grdItems.EditItems[0].FireCommandEvent("UpdateEdited", string.Empty);
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.Print("Error: " + ex.ToString());
        Exceptions.ProcessModuleLoadException(this, ex);
    }
}

Here is the UpdateCommand event from the grid's code:
protected void grdItems_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    GridEditableItem itmUpdatedRow = null;
    Hashtable tblUpdatedValues = null;
 
    try
    {
        //Get the details of the item that needs to be updated
        itmUpdatedRow = e.Item as GridEditableItem;
        tblUpdatedValues = new Hashtable();
 
        //Parse out the updated data
        e.Item.OwnerTableView.ExtractValuesFromItem(tblUpdatedValues, itmUpdatedRow);
 
        //Update the underlying data table with the updated information (THIS IS ALWAYS FALSE REGARDLESS OF CHECKED STATUS)
        _propsSettings.Records.Rows[e.Item.DataSetIndex]["Checked"] = tblUpdatedValues["Checked"].ToString().GetBoolean();
 
        grdItems.Rebind();
 
        CleanUpData();
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.Print("Error: " + ex.ToString());
        Exceptions.ProcessModuleLoadException(this, ex);
    }
    finally
    {
        SaveControlState();
 
        //Clean up
        if (tblUpdatedValues != null)
        {
            tblUpdatedValues.Clear();
            tblUpdatedValues = null;
        }
    }
}

Here, the line that uses 'tblUpdatedValues["Checked"]' is ALWAYS False regardless of the check boxes status.  I had a similar issue before using a dropdown column but I got around that by changing it's editor to a standard ASP.NET dropdown.  I tried doing the same here but I got the same results.  The value of the Checked column is ALWAYS False no matter what I do.

This method shouldn't matter but I'm including it for completeness' sake (this code would only have an impact if at least 1 checkbox is detected as checked):
/// <summary>
/// Cleans up the Items grid data to make sure any invalid rows are removed.
/// </summary>
private void CleanUpData()
{
    try
    {
        _propsSettings.TotalPrice = 0;
        _propsSettings.ShippingTotal = 0;
        _propsSettings.LateFees = 0;
 
        if (_propsSettings.Records.Rows.Count > 0)
        {
            //Start at the end so that removing rows won't cause the index to be incorrect
            for (int iItems = (_propsSettings.Records.Rows.Count - 1); iItems > -1; iItems--)
            {
                try
                {
                    //Item was selected for removal
                    if (_propsSettings.Records.Rows[iItems][0].ToString().GetBoolean())
                    {
                        //Delete the line item database record and remove it from the data set
                    }
                    else
                    {
                        //Track the calculated totals
                        _propsSettings.ShippingTotal += _propsSettings.Records.Rows[iItems]["ShippingPrice"].ToString().GetNumber();
                        _propsSettings.TotalPrice += ((_propsSettings.Records.Rows[iItems]["OriginalPrice"].ToString().GetNumber() * _propsSettings.Records.Rows[iItems]["Quantity"].ToString().GetNumber()) + _propsSettings.Records.Rows[iItems]["ShippingPrice"].ToString().GetNumber());
 
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Print("Error: " + ex.ToString());
                }
            }
        }
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.Print("Error: " + ex.ToString());
        Exceptions.ProcessModuleLoadException(this, ex);
    }
    finally
    {
        SaveControlState();
 
        UpdateCartTotals();
        grdItems.Rebind();
    }
}


I've searched the forums, read the help articles, looked at the demos, but cannot figure out what is wrong.  Any ideas?
J
Top achievements
Rank 1
 answered on 26 Mar 2013
5 answers
109 views
Can someone look at this and see what style I need to modify to get rid of the white space or image that is appearing at the bottom of the radComboBox? 

I assume it's a styling issue.  This happens while rendering in IE7.

Thanks, Dave.

Hristo Valyavicharski
Telerik team
 answered on 26 Mar 2013
2 answers
69 views
Hello everyone,

I have a question with regards to Radscheduler date display. By default, my scheduler will only show MonthView. For some reasons, the first day of the month always shows as MMM dd format. I want it to show a single digit day but the closest I'm able to do it is by changing the attribute FirstDayHeaderDateFormat to take a value of "dd", which effectively turns it into 01.

I tried supplying it a value of "d" but to no avail. When I used "d", I ended up with 01/03/2013 format. Is there anyway to keep the first day of the month to single digit?

Thanks in advance.
Jonathan
Top achievements
Rank 2
 answered on 26 Mar 2013
2 answers
171 views
I have a radGrid control with that loads a binary image from a sqlDataSource in a GridBinaryImageColumn. It works fine, but I attached an onclick event with code behind, and use a javascript/jquery block code to zoom the image.

The problem is that the image is downloaded using the height/width properties, and when I resize the image, it is grainy, because it was set to resize mode fit. This is great because the image is small so the download is fast.

However, I am using a jQuery Light Box to display the image when it is clicked. Code works fine, except I am using the link from the cell.innerHTML to load the image in a lightbox, and this is the code:

var selectedCell = args.get_gridDataItem().get_cell("UploadPicture");
var image = selectedCell.innerHTML;
var myHref = $(image).attr('src');
 
The src is something like src="Telerik.Web.UI.WebResource.axd?imgid=c7c37cd7e2874a99a04cfe282e769c95&type=rbi"

The image loads fine, however, if I try to resize the image using height/width attributes, the image becomes grainy because the original image that was downloaded was compressed to the settings in the grid control.

Question, is there an easy way to use the Telerik.Web.UI.WebResource.axd?imgid method to call a different size of the same image?

Or, is there an easier way to accomplish this?

Thanks in advance.

Henry
Top achievements
Rank 1
 answered on 26 Mar 2013
3 answers
169 views
Is it possible to add context menu to each node in the Orag chart.
Kate
Telerik team
 answered on 26 Mar 2013
1 answer
125 views
I'm trying to created a grid hierarchy as outlined in this example. I'm using the DetailsTables method (as opposed to NestedViewTemplate) and I would like to put a GridClientSelectColumn on the sub-grid, allowing the user to select only one item from each sub-grid. When i set the parent's AllowMultiRowSelection="False", however, this causes all the sub-grid's to act as a single group, allowing the user to only select 1 item from ALL sub-grids. The definition for my grid is as follows

<telerik:RadGrid runat="server" ID="ledger" Width="900px" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="false" PageSize="10" AllowFilteringByColumn="true" OnNeedDataSource="ledger_NeedDataSource" OnDetailTableDataBind="ledger_DetailTableDataBind" AllowMultiRowSelection="False">
  <GroupingSettings CaseSensitive="false" />
  <ClientSettings EnableRowHoverStyle="true" EnableAlternatingItems="true">
    <Selecting AllowRowSelect="True"  UseClientSelectColumnOnly="True"/>
  </ClientSettings>
  <MasterTableView DataKeyNames="SubstanceId, Name, CAS" ClientDataKeyNames="SubstanceId"  
        ShowHeadersWhenNoRecords="true" CommandItemDisplay="None" Font-Size="10">
    <DetailTables>
      <telerik:GridTableView runat="server" Name="SuggestedComponents" PageSize="5"
            AllowFilteringByColumn="False" AllowSorting="False" AutoGenerateColumns="False" ShowFooter="True">
        <Columns>
          <telerik:GridBoundColumn HeaderText="Name" UniqueName="SuggestionPrimaryName"
               DataType="System.String" AllowSorting="False" AllowFiltering="False" DataField="PrimaryName" />
          <telerik:GridBoundColumn HeaderText="CAS" UniqueName="SuggestionCAS" DataType="System.String"
                AllowSorting="False" AllowFiltering="False" DataField="CAS" />
          <telerik:GridClientSelectColumn UniqueName="SuggestionSelect" />
        </Columns>
      </telerik:GridTableView>
    </DetailTables>
    <Columns>
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="SubstanceName"
            HeaderText="Name" DataField="Name" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="CAS"
            HeaderText="CAS" DataField="CAS" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="ProductCode"
            HeaderText="Product Code" DataField="ProductCode" />
      <telerik:GridBoundColumn AllowSorting="true" DataType="System.String" UniqueName="ClientSubstanceId"
            HeaderText="Client ID" DataField="ClientSubstanceId" />
    </Columns>
  </MasterTableView>
</telerik:RadGrid>

How can I achieve a single-select-per-sub-grid behavior?
Kostadin
Telerik team
 answered on 26 Mar 2013
1 answer
58 views
It appears that with the latest release the sprite file for the radcombobox has changed. With the previous version we modified the photoshop file to create a "Required" image that would be substituted out if the combo failed validation. With this change our modified image no longer works. Is there a photoshop file available for the sprites for the latest version of the radcombobox?

Thanks,
Kate
Telerik team
 answered on 26 Mar 2013
22 answers
403 views
Hi All,

I was wondering if anyone is using the HierarchyID to create XML for the treeview control, or even better if Telerik is making a change to bind a treeview to a dataset with the HierarchyID datatype.

I found this post, but there was no follow up from Telerik.

Thanks
Mako
Top achievements
Rank 1
 answered on 26 Mar 2013
1 answer
185 views
Hi,

When i expand a row in dynamic radgrid, i get error "Microsoft Jsscript runtime error: 'null' is null or not an object" on client side. I have used Client HierarchyLoadMode.

OrdersGridz.MasterTableView.HierarchyLoadMode =

 

GridChildLoadMode.Client;

 

 
Please see the error attached. Please help, it is killing me.

Code behind:
public void LoadDynamicData()
   {
       List<Orders> lstOrders = new List<Orders>();
       lstOrders.Add(new Orders() { CompanyName = "Readable VoiceMail", OrderID = 1, OrderDate = DateTime.Now, TelNumbers = "1234567890" });
       lstOrders.Add(new Orders() { CompanyName = "Call Blocking", OrderID = 3, OrderDate = DateTime.Now, TelNumbers = "1234567890" });
       lstOrders.Add(new Orders() { CompanyName = "Readable VoiceMail", OrderID = 2, OrderDate = DateTime.Now, TelNumbers = "1237894560" });        
       var telNumbers =
              (from dbo in lstOrders
               select dbo.TelNumbers).Distinct().OrderBy(TelNumbers => TelNumbers);
       RadGrid OrdersGridz = new RadGrid();
       foreach (string tel in telNumbers)
       {
           OrdersGridz = new RadGrid { ID = "OrdersGridz" };
                       
           OrdersGridz.ClientSettings.AllowExpandCollapse = true;
           OrdersGridz.DetailTableDataBind += new GridDetailTableDataBindEventHandler(OrdersGridz_DetailTableDataBind);
           OrdersGridz.EnableLinqExpressions = false;
           OrdersGridz.MasterTableView.ShowHeader = true;
             
           GridTableView tableViewOrders = new GridTableView(OrdersGridz);
           tableViewOrders.ClientDataKeyNames = new string[] { "OrderID" };
           tableViewOrders.DataKeyNames = new string[] { "OrderID" };
           tableViewOrders.Name = "Orders";
           tableViewOrders.AutoGenerateColumns = true;
           GridRelationFields relationFields = new GridRelationFields();
           relationFields.MasterKeyField = "OrderID";
           relationFields.DetailKeyField = "OrderID";
           tableViewOrders.ParentTableRelation.Add(relationFields);
           OrdersGridz.MasterTableView.AutoGenerateColumns = true;
           OrdersGridz.MasterTableView.ClientDataKeyNames = new string[] { "OrderID" };
           OrdersGridz.MasterTableView.DataKeyNames = new string[] { "OrderID" };
           OrdersGridz.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;
           OrdersGridz.MasterTableView.DetailTables.Add(tableViewOrders);
           OrdersGridz.InsertCommand+=new GridCommandEventHandler(OrdersGridz_InsertCommand);
            
           var lstOrdersz =
              (from dbo in lstOrders
               select dbo).Where(x => x.TelNumbers.Equals(tel)).ToList();
           OrdersGridz.DataSource = lstOrdersz;
           OrdersGridz.DataBind();
             
           //adding raddock dynamically
           RadDock dock = new RadDock();
           dock.ID = tel;
           dock.Title = tel;
           dock.DockMode = DockMode.Docked;
           dock.EnableDrag = false;
             
           dock.Commands.Add(new DockExpandCollapseCommand());
           dock.Command += new DockCommandEventHandler(dock_Command);
           dock.ContentContainer.Controls.Add(OrdersGridz);
           RadDockZone5.Controls.Add(dock);
                      
       }        
   }
   protected void OrdersGridz_InsertCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.ExpandCollapseCommandName)
       {
             
       }
   }
   protected void OrdersGridz_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
   {
       List<Products> lstProducts = new List<Products>();
         
       lstProducts.Add(new Products() { ProductName = "A", UnitPrice = 0, OrderID = 1 });
       lstProducts.Add(new Products() { ProductName = "B", UnitPrice = 0, OrderID = 1 });
       lstProducts.Add(new Products() { ProductName = "C", UnitPrice = 0, OrderID = 1 });
       lstProducts.Add(new Products() { ProductName = "X", UnitPrice = 0, OrderID = 2 });
       lstProducts.Add(new Products() { ProductName = "Y", UnitPrice = 0, OrderID = 2 });
       lstProducts.Add(new Products() { ProductName = "M", UnitPrice = 0, OrderID = 3 });
       lstProducts.Add(new Products() { ProductName = "N", UnitPrice = 0, OrderID = 3 });
       lstProducts.Add(new Products() { ProductName = "O", UnitPrice = 0, OrderID = 3 });
       lstProducts.Add(new Products() { ProductName = "P", UnitPrice = 0, OrderID = 3 });
       GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
       switch (e.DetailTableView.Name)
       {
           case "Orders":
               {
                   string OrderID = dataItem.GetDataKeyValue("OrderID").ToString();
                   e.DetailTableView.DataSource = lstProducts.Where(x => x.OrderID.ToString().Equals(OrderID, StringComparison.OrdinalIgnoreCase)).ToList();
                   break;
               }
       }
   }


Thanks in Advance for your help.

Ashok
Angel Petrov
Telerik team
 answered on 26 Mar 2013
0 answers
159 views
Hi 

i have created a query for my treeview hierarchy and it displays fine, i have also added the tootip value and can see this for each level - a sample is below

001 (company)
001001 (company & location)
001001005 (company & location & module)
001001005001 (company & location & module & addon)
001001005002 (company & location & module & addon)
001001005003(company & location & module & addon)
001001005004(company & location & module & addon)
001001005005(company & location & module & addon)

As i say this renders fine but my problem is that when i try to get the values of what the user selects some values are missing from in this instance 001001005002

Here is a snippet of my code

public void saveCheckedPrivileges()
{
    int test = RadTreeView2.CheckedNodes.Count;
    if (RadTreeView2.CheckedNodes.Count > 0)
    {
        IList<RadTreeNode> nodeCollection = RadTreeView2.CheckedNodes;
        string startingRec = null;
        string[] val = null;<br>               
        List<string[]> valsToStore = new List<string[]>();
        foreach (RadTreeNode node in nodeCollection)
        {
             string fileid = node.Value.ToString();
             //Do Whatever with checked value
        }
}

i've also tried with GetAllNodes() and the result is the same - any help would be greatly appreciated :)

Ciaran
Top achievements
Rank 1
 asked on 26 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?