Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
123 views
I am displaying a list of objects in a grid. One property of the object is a boolean value that I'd like to be able to allow the user to change simply checking/unchecking a checkbox. I want this to be a one-click solution - that is to say, I don't want them to have to select the row, go into edit mode, check the box, choose to save the records, etc. If the box gets checked, I want to update the record that it is bound to.

Simple enough I think, but going about this seems so problematic.

At first, I tried using a GridCheckBoxColumn. This correctly displays the value of the property, but is disabled. I learned that is because this will only enable if the row is in Edit mode. I added some code to the Pre_Render() event which causes every single row to be set to edit mode initially, but this looks pretty ugly - all the rows have dark lines on them, and I have to go back and explicitly set every other control in the row to ReadOnly so that they aren't editable.

My second attempt involved using a GridTemplateColumn, and an asp:CheckBox which is bound (Bind(MyProperty)) to the property. This also displays the value fine, but I'm not sure how to handle it past that. Checking the box doesn't seem to update the bound data? I figured maybe I could set AutoPostBack=True and call the OnChecked() function to set the value manually, but how do I get a reference to the row/item being checked?

Any help would be appreciated.
Princy
Top achievements
Rank 2
 answered on 08 Dec 2010
1 answer
55 views
I have a column in my grid that needs to change from either a dropdownbox or textbox based on the previous columns dropdown value.
Is this possible?

If you have any suggestions would be helpful.
Princy
Top achievements
Rank 2
 answered on 08 Dec 2010
1 answer
413 views
I have a radgrid with a readonly column named Status.  After my validation completes I need to change the value of the column if there is an error.  I'm having problems changing the value. Any suggestions would be helpful.

if (errorCount > 0)
{               
    TableCell statusCell = item["STATUS"];
    (statusCell.Controls[0] as TextBox).Text = "Error";
    (statusCell.Controls[0] as TextBox).BackColor = System.Drawing.Color.Red;
}
<telerik:RadGrid ID="rdDeposits" AllowSorting="False" AllowPaging="False" runat="server"
                            AutoGenerateColumns="False" AllowAutomaticInserts="False" OnPreRender="rdDeposits_PreRender" 
                            AllowAutomaticDeletes="False" Skin="Web20" OnNeedDataSource="rdDeposits_NeedDataSource"
                             OnItemDataBound="rdDeposits_ItemDataBound" GridLines="Horizontal"  OnItemCommand="rdDeposits_ItemCommand" 
                             OnItemCreated="rdDeposits_ItemCreated" OnDeleteCommand="rdDeposits_ItemDeleted"
                            AllowMultiRowEdit="False" Width="738px" Height="360px">
                            <MasterTableView ShowFooter="true" DataKeyNames="ESCROW_ACCOUNT_DEPOSIT_ID" CommandItemDisplay="Top" EditMode="InPlace" TableLayout="Fixed">
                                <CommandItemTemplate>
                                    <div style="padding: 5px 5px;">
                                        <asp:Button ID="btnAdd" CommandName="InitInsert" Text="Add Transaction" runat="server" />
                                    </div>
                                </CommandItemTemplate>
                                <Columns> 
                                    <telerik:GridBoundColumn DataField="ESCROW_ACCOUNT_DEPOSIT_ID" UniqueName="ESCROW_ACCOUNT_DEPOSIT_ID"
                                        ReadOnly="true" Visible="false">
                                    </telerik:GridBoundColumn>                                                                                               
                                    <telerik:GridDropDownColumn DataField="DEPOSIT_TRANS_TYPE_ID" HeaderText="Type" UniqueName="DEPOSIT_TRANS_TYPE_SDESC" 
                                        ListTextField="DEPOSIT_TRANS_TYPE_SDESC" ListValueField ="DEPOSIT_TRANS_TYPE_ID"
                                        DropDownControlType="DropDownList"  ColumnEditorID="GridDropDownColumnEditor1">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="110px" />
                                        <FooterStyle HorizontalAlign="Right" Font-Bold="true" /> 
                                    </telerik:GridDropDownColumn>                                                      
                                    <telerik:GridBoundColumn DataField="EXPECTED_DATE" HeaderText="Expected Date" UniqueName="EXPECTED_DATE"
                                        ReadOnly="true">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="90px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="EXPECTED_AMOUNT" HeaderText="Expected Amount"
                                        UniqueName="EXPECTED_AMOUNT" ReadOnly="true">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="100px" />
                                        <ItemStyle HorizontalAlign="Right"/>
                                        <FooterStyle HorizontalAlign="Right" Font-Bold="true" /> 
                                    </telerik:GridBoundColumn>
                                    <telerik:GridDateTimeColumn DataField="ACTUAL_DATE" HeaderText="Actual Date" UniqueName="ACTUAL_DATE"
                                        DataType="System.DateTime" ColumnEditorID="GridDateTimeColumnEditor">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="100px" />                                        
                                    </telerik:GridDateTimeColumn>
                                    <telerik:GridNumericColumn DataField="ACTUAL_AMOUNT" HeaderText="Actual Amount" UniqueName="ACTUAL_AMOUNT"
                                         NumericType="Currency" Resizable="False" MaxLength="8" DataType="System.Decimal"  >
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="100px"  />
                                        <ItemStyle HorizontalAlign="Center" />   
                                        <FooterStyle HorizontalAlign="Right" Font-Bold="true" />                                                                                                                                                                                                                                                                
                                    </telerik:GridNumericColumn>                                                                                                  
                                    <telerik:GridBoundColumn DataField="STATUS" HeaderText="Status" UniqueName="STATUS"
                                         ReadOnly="true">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="90px" />
                                        <ItemStyle HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>                                                                    
                                    <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete"
                                         ImageUrl='../Images/deleteX.GIF' CommandName="Delete" UniqueName="Delete">
                                        <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="15px" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn DataField="EXPECTED_TRANSACTION_IND" UniqueName="EXPECTED_TRANSACTION_IND" ReadOnly="true"
                                       Visible="false" ForceExtractValue="Always" >
                                    </telerik:GridBoundColumn>                                       
                                </Columns>                                                                                             
                            </MasterTableView>
                            <SelectedItemStyle BackColor="#F8C320" />
                            <ClientSettings EnableRowHoverStyle="true">
                                <Selecting AllowRowSelect="true" />
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
                            </ClientSettings>            
                        </telerik:RadGrid>


Thanks
Princy
Top achievements
Rank 2
 answered on 08 Dec 2010
1 answer
90 views

Hi, I have a question in regards to selective delete.  I have a grid with delete option defined as below

 

 

 

 

<telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"

 

 

ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"

 

 

UniqueName="DeleteAlignment">

Now, I want to selectivele remove the delete option on some of the rows.  Is there a way to do that?  So I wan say delete option on the first 5 rows only... or something like that

Princy
Top achievements
Rank 2
 answered on 08 Dec 2010
8 answers
212 views
When i use GridClientSelectColumn in a RadGrid and set it to allow scroll, it will get a scroll bar for the outer body.
Detail please see the attach.

Example code to get the issue:

<telerik:RadFormDecorator ID="formdecorator" runat="server" DecoratedControls="All"
        ControlsToSkip="Zone" />
        <telerik:RadGrid ID="rgFr" runat="server" PageSize="50">   
    <MasterTableView DataKeyNames="A">
        <Columns>
            <telerik:GridClientSelectColumn ItemStyle-Width="20" />           
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="true" />
        <Scrolling AllowScroll="true" ScrollHeight="300" />
    </ClientSettings>

In the code-behind:

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                var ds = new List<object>();
                for (int i = 0; i < 100; i++)
                {
                    ds.Add(new { A = "AA" });
                }
                this.rgFr.DataSource = ds;

                this.rgFr.DataBind();
            }
        }


Amir
Top achievements
Rank 2
 answered on 08 Dec 2010
26 answers
449 views
Hi guys,

New slider looks very tasty (in fact it all does) but can we have a two thumb version of the slider. Very useful for specifying numeric ranges ie. ring size > 4 and ring size < 8

Cheers,

Pete
Vanessa
Top achievements
Rank 1
 answered on 08 Dec 2010
1 answer
118 views

Hi,
I'm relatively new to the Radgrid and EntitySpaces. I know that they work extremely well together but I've been stumped for a few hours today with a problem. I've got a rad grid that is bound to an esDataSource, the datasource has a field that is a lookup value. I can bind the grid to the initial datasource and at this stage insertion and editing works fine. However, when I use a template column to add an dropdown control for the look up field (binding it in the ItemDataBound event handler), I can edit values well but when I insert new values though the lookup values are saved as empty values. I cant seem to grab the lookup dropdown value during the insert event.

Any suggestions would be helpful. Sample code or examples would be appriciated.

Here's my code:

<asp:Panel ID="pnlBreadcrumb" runat="server">
</asp:Panel>
  
<asp:Label ID="lblMessage" runat="server" Visible="false" Text="No list configuration found" />
  
  
<telerik:RadGrid ID="grdLevelValues" runat="server" GridLines="None" 
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" 
    DataSourceID="datListValues" AutoGenerateColumns="False" 
    onitemcommand="grdLevelValues_ItemCommand" 
    onitemdatabound="grdLevelValues_ItemDataBound" 
    onitemcreated="grdLevelValues_ItemCreated"    
    AllowSorting="True"
    AllowPaging="True" 
    PageSize="25"
    >
<HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu>
  
<MasterTableView datakeynames="IdBusinessUnit" datasourceid="datListValues" CommandItemDisplay="Top" EditMode="InPlace">
    <Columns>
        <telerik:GridBoundColumn DataField="BusinessUnitName" HeaderText="Business Unit" 
            UniqueName="column1">            
        </telerik:GridBoundColumn>                    
        <telerik:GridTemplateColumn UniqueName="State">
            <HeaderTemplate>
                <asp:Label ID="lblStateNameHeader" Text="State Name" runat="server"></asp:Label>               
            </HeaderTemplate>
            <ItemTemplate>
                <asp:Label ID="lblStateName" runat="server" Text='<%# Eval("UpToAddressStateItemByIdState.State") %>' />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:DropDownList ID="ddlStateName" runat="server"></asp:DropDownList>
            </EditItemTemplate>
        </telerik:GridTemplateColumn
                                                                         
  
          
        <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
         
    </Columns>
  
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
</telerik:RadGrid>
  
  
  
<cc1:esDataSource ID="datListValues" runat="server" 
    onescreateentity="datListValues_esCreateEntity" 
    onesselect="datListValues_esSelect"
    AutoPaging="true" 
    AutoSorting="true"/>

code behind:
protected void Page_Load(object sender, EventArgs e)
       {
                 }
       protected void grdLevelValues_ItemCommand(object source, GridCommandEventArgs e)
       
                 }
       protected void grdLevelValues_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if ((e.Item is GridEditableItem) && e.Item.IsInEditMode)
           {
                
               AddressStateCollection states = new AddressStateCollection();
               states.Query.SelectAll();
               states.Query.Load();
               GridEditableItem gridEditableItem = (GridEditableItem)e.Item;
                  
               DropDownList dropDownList = (DropDownList)gridEditableItem["State"].FindControl("ddlStateName");
               dropDownList.DataSource = states;
               dropDownList.DataTextField = "State";                
               dropDownList.DataValueField = "IdState";
                 
               //Find the selected index by assuming that the ddl datasource will maintain the order inwhich its items were added.
               int ddlSelectedIndex =0;
               foreach(AddressStateItem state in states)
               {
                  if ((gridEditableItem.DataItem is GridInsertionObject) == false)                   
                   {
                       if (state.IdState == System.Convert.ToInt32(((Westpac.VOS.Data.BusinessUnitItem)gridEditableItem.DataItem).IdState))
                       {
                           break;
                       }
                       ddlSelectedIndex ++;
                   }
                   else
                       break;
               }
               dropDownList.SelectedIndex =  ddlSelectedIndex; 
                 
               dropDownList.DataBind();
           }   
       }
       protected void grdLevelValues_ItemCreated(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridEditableItem && e.Item.IsInEditMode)
           {
               GridEditableItem item = e.Item as GridEditableItem;
               //validation code goes here...
           }
       }
       protected void datListValues_esSelect(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e)
       {
           BusinessUnitCollection values = new BusinessUnitCollection();
           values.Query.SelectAll();
           values.Query.Load();
           e.Collection = values;
         
       }
       protected void datListValues_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e)
       {
           BusinessUnitItem entity = new BusinessUnitItem();
           // Insert
           if (e.PrimaryKeys == null) // A new record to be created
           {
               entity.AddNew();
               entity.IdBrand = VosContext.Current.Brand.Id;
               foreach (GridDataItem item in this.grdLevelValues.Items)
               {
                   DropDownList dropDownList = (DropDownList)item["State"].FindControl("ddlStateName");
                   if (dropDownList != null)
                   {
                       entity.IdState = System.Convert.ToInt32(dropDownList.SelectedValue);
                   }
               }  
           }
           else // Update
           {                
               entity.LoadByPrimaryKey((int)e.PrimaryKeys[0]);
               
               foreach (GridDataItem item in this.grdLevelValues.Items)
               {
                    
                    DropDownList dropDownList = (DropDownList)item["State"].FindControl("ddlStateName");
                    
                    if (dropDownList != null)
                    {
                        entity.IdState = System.Convert.ToInt32(dropDownList.SelectedValue);
                    }
                 
               }  
                  
           }
           e.Entity = entity;
       }
       

evo
Top achievements
Rank 1
 answered on 08 Dec 2010
2 answers
170 views
I have version 2008.3.1125.20 of the Telerik RadControls for ASP.NET AJAX.

Does some newer version of Telerik.Web.UI.dll support Japanese language in the chart? Currently, all I get is squares showing up in place of the actual characters.
Gregory
Top achievements
Rank 1
 answered on 08 Dec 2010
1 answer
91 views

Hi guys,
I have a following code in my aspx page:

 

<

 

telerik:GridTemplateColumn HeaderText ="Eis-Id" UniqueName ="PRICol" Groupable="true" DataField="FILENO" SortExpression="FILENO" ReadOnly="true" HeaderButtonType="TextButton">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="PRI" runat="server" ></asp:Label>

 

 

 

<asp:Image ID="Image1" runat="server" AlternateText="EIS CHARGES"/>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 


When I export grid to pdf I need to hide image label.I need just PRI label on the report.

I add some code but entire column disappeared from pdf:

DetailGrid.MasterTableView.GetColumn(

"PRICol").Visible = false;

 


Thanks so much for your help.
Daniel
Telerik team
 answered on 07 Dec 2010
1 answer
62 views
I'm exporting a radgrid to Excel successfully. This is my code
gvwMaterial.ExportSettings.ExportOnlyData = true;
gvwMaterial.ExportSettings.IgnorePaging = true;
gvwMaterial.ExportSettings.OpenInNewWindow = true;
gvwMaterial.ExportSettings.Excel.Format = GridExcelExportFormat.Html;
gvwMaterial.ExportSettings.FileName = String.Format("File_{0}_{1}_in_{2}.xls", aaa, bbb.ToString(), ccc.ToString());
gvwMaterial.MasterTableView.ExportToExcel();

When Excel is opened, numbers with decimals, (percents like 0.12), are rounded to 0 or 1
How I can to format this columns?

Thanks

Carlos 
Daniel
Telerik team
 answered on 07 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?