Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
278 views

Hi, I am using Tekerik:RadGrid and I have columns as Quantity, UnitPrice and TotalPrice.


I provide Textboxes to enter Quantity and Unit Price and upon these entry, immediately TotalPrice Label should be calculated as quantity * Unit Price. 


Now, I also display the total of all the Total Price in a different Label control.


I want to know how can I write a Javascript function to attach it on "onkeyup" event of Quantity and Unit Price textboxes so that whenever there is any change in any quantity or any unit price, it calculates every thing and fills out total also.


Just for information, here is my RadGrid Control:

#####################################

<telerik:RadGrid ID="RadGridDetails" runat="server" AllowPaging="false"   
AllowSorting="true" AutoGenerateColumns="False" GridLines="Both"   
OnNeedDataSource="RadGridDetails_needdatasource" Skin="Default" 
OnItemDataBound="RadGridDetails_ItemDataBound" 
ShowFooter="true" 
 
> 
                                        <PagerStyle Mode="NextPrevAndNumeric" /> 
                                        <ClientSettings EnableRowHoverStyle="true" > 
                                        </ClientSettings> 
                                        <MasterTableView ShowHeadersWhenNoRecords="true">  
                                            <Columns> 
 
                          
 
                                                <telerik:GridTemplateColumn HeaderText="Row_Number"   
                                                    SortExpression="Row_Number" UniqueName="Row_Number">  
                                                    <ItemTemplate> 
                                                        <asp:Label ID="lblRow_Number" runat="server"   
                                                            Text='<%# Bind("Row_Number")%>'></asp:Label> 
                                                    </ItemTemplate> 
                                                </telerik:GridTemplateColumn> 
 
 
                                                <telerik:GridTemplateColumn > 
                                                    <ItemTemplate> 
                                                        <asp:Button runat="server" ID="btnDeleteProduct" text="Delete"   
                                                            CssClass="ButtonCSS" 
                                                            ToolTip="Click here to delete this product" 
                                                            CausesValidation="true"   
                                                            OnClientClick="javascript:return confirm('Are you sure you want to delete this Product Information? ');" 
                                                            onclick="btnDeleteProduct_Click"   
                                                            CommandArgument='<%#   
                                                            Eval ( "RequestInfoProductDetailID").ToString()   
                                                            + ";" +    
                                                            Eval ( "Row_Number").ToString()  
                                                            %>'  
                                                            /> 
                                                    </ItemTemplate> 
                                                    <FooterTemplate> 
                                                        <asp:Button runat="server" ID="btnAddProduct" text="Add New Product"   
                                                            CssClass="ButtonCSS" 
                                                            ToolTip="Click here to add this new product to the list" 
                                                            CausesValidation="true" onclick="btnAddProduct_Click"   
                                                            /> 
                                                    </FooterTemplate> 
                                                </telerik:GridTemplateColumn>        
 
 
 
                                                <telerik:GridTemplateColumn HeaderText="Quantity" UniqueName="Quantity">  
                                                    <ItemTemplate> 
                                                        <asp:TextBox ID="txtQty" Runat="server" MaxLength="7"   
                                                            Text='<%# Bind("Quantity") %>'   
                                                            onkeyup='isNumber(this)' 
                                                              
                                                            ToolTip="Enter quantity"   
                                                            ></asp:TextBox> 
                                                              
                                                              
                                                                    <asp:CompareValidator ID="cvQty" runat="server"   
                                                                    Display="Dynamic" ErrorMessage="Please enter a valid quantity"   
                                                                    ControlToValidate="txtQty"  Operator="DataTypeCheck"    
                                                                    Type="Integer" ></asp:CompareValidator> 
                                                    </ItemTemplate> 
                                                    <FooterTemplate> 
                                                        <asp:TextBox ID="txtEnterQty" Runat="server" MaxLength="7"   
                                                            ToolTip="Enter quantity"   
                                                            ></asp:TextBox> 
                                                                    <asp:CompareValidator ID="cvEnterQty" runat="server"   
                                                                    Display="Dynamic" ErrorMessage="Please enter a valid quantity"   
                                                                    ControlToValidate="txtEnterQty"  Operator="DataTypeCheck"    
                                                                    Type="Integer" ></asp:CompareValidator> 
                                                    </FooterTemplate> 
                                                </telerik:GridTemplateColumn>        
 
 
                                                <telerik:GridTemplateColumn HeaderText="Unit Cost"  SortExpression="UnitCost" UniqueName="UnitCost">  
                                                    <ItemTemplate> 
                                                        <asp:TextBox ID="txtUnitCost" Runat="server" MaxLength="10"   
                                                            Text='<%# Bind("UnitCost") %>'   
                                                            ToolTip="Enter Unit Cost"   
                                                            visible="false" 
                                                            ></asp:TextBox> 
                                                              
                                                              
                                                                    <asp:CompareValidator ID="cvUnitCost" runat="server"   
                                                                    Display="Dynamic" ErrorMessage="Please enter a valid amount"   
                                                                    ControlToValidate="txtUnitCost"  Operator="DataTypeCheck"    
                                                                    Type="Double" ></asp:CompareValidator> 
                                                    </ItemTemplate> 
                                                    <FooterTemplate> 
                                                        <asp:TextBox ID="txtEnterUnitCost" Runat="server" MaxLength="10"   
                                                            ToolTip="Enter Unit Cost"   
                                                            ></asp:TextBox> 
                                                                    <asp:CompareValidator ID="cvEnterUnitCost" runat="server"   
                                                                    Display="Dynamic" ErrorMessage="Please enter a valid amount"   
                                                                    ControlToValidate="txtEnterUnitCost"  Operator="DataTypeCheck"    
                                                                    Type="Double" ></asp:CompareValidator> 
                                                    </FooterTemplate> 
                                                </telerik:GridTemplateColumn>        
 
 
 
                                                <telerik:GridTemplateColumn HeaderText="Total Cost"    
                                                    SortExpression="TotalCost"   
                                                    UniqueName="TotalCost">  
                                                    <ItemTemplate> 
                                                        <asp:Label runat="server" ID="lblTotalCost" Text='<%# Bind("TotalCost") %>' ></asp:Label> 
                                                              
                                                          
                                                          
                                                    </ItemTemplate> 
                                                    <FooterTemplate> 
                                                        <asp:Label runat="server" ID="lblFooterTotalCost" ></asp:Label> 
                                                    </FooterTemplate> 
                                                </telerik:GridTemplateColumn>        
 
 
 
                                            </Columns> 
                                            <EditFormSettings> 
                                                <PopUpSettings ScrollBars="None" /> 
                                            </EditFormSettings> 
                                            <ExpandCollapseColumn Resizable="False" Visible="False">  
                                                <HeaderStyle /> 
                                            </ExpandCollapseColumn> 
                                            <RowIndicatorColumn Visible="False">  
                                                <HeaderStyle /> 
                                            </RowIndicatorColumn> 
                                        </MasterTableView> 
                                    </telerik:RadGrid>     
 
 
 
 
<asp:Label ID="lblSubTotal" runat="server" ></asp:Label> 
 
 

#####################################

Nirav
Top achievements
Rank 1
 answered on 09 Dec 2009
1 answer
104 views
Hi, I'm creating FileBrowserContentProvider, and the Treeview is populated with "folders" which are actualljust database records. How can I enable the Upload tab? I tried setting the ImagsPath and the UploadImagesPath to an existing subfolder, but the Upload button remains disabled.

Any ideas?
Fiko
Telerik team
 answered on 09 Dec 2009
5 answers
121 views
Hi all,

I have a big big problem, I try to explain it but is not simple.

I open a modal radwindow... works fine... in the popped-up windows I have some input component (RadComboBox, RadDatePicker...)... when I click on RadComboBox for example appens a crazy thing: in the main page there is a button in the same position of the RadComboBox of the popped-up windows, and clicking on the RadComboBox for select a value also triggered the event of the button of the main page. 

I hope to be able to explain the problem.

How I can fix this issue

EDIT: I've made a simple demo with a screenshot to reproduce this very big problem that in my opinion is a big BUG

Georgi Tunev
Telerik team
 answered on 09 Dec 2009
2 answers
133 views
Hello,

I'm hoping for some quick advice on how to tackle this problem.

I am using a RadGrid along with the GridClientSelectColumn column for selecting rows in the RadGrid.  Once the user selects 1 or more rows, they can click a separate button which opens up a RadWindow where they can then perform an action on the ID's that were passed to the RadWindow from the selected rows of the RadGrid.

How can I deselect the rows of the RadGrid after closing the RadWindow?

Thanks so much!
Jason

Jason Zam
Top achievements
Rank 1
 answered on 09 Dec 2009
6 answers
353 views
Hello,

I'm having trouble overriding the default .rcbHover css in a customized skin.

I have a single ComboBox with a custom skin derived from Web20.  I have a situation where I need to apply a specific item style based on some conditions.  I do this by setting the RadComboBoxItem's CssClass property in the code-behind.  The problem I'm encountering is that when the user hovers over the specific item with the new class I get the default hover class.

My code may help explain:

ASPX:
<script language="javascript" type="text/javascript"> 
    function cboOpening(sender, eventArgs) 
    { 
        //alert('cboOpening() called.'); 
       if (sender.get_items().get_count() <= 1) 
         sender.requestItems(sender.get_text(),false); 
    } 
</script> 
 
 
<telerik:RadComboBox ID="cbo" Runat="server" Height="200px" Width="400px" AutoPostBack="true" 
    EnableLoadOnDemand="false" 
    ShowDropDownOnTextboxClick="true" 
    MarkFirstMatch="true" 
    AllowCustomText="false" 
    ShowMoreResultsBox="false" 
    ItemRequestTimeout="500" 
    OnItemsRequested="cbo_ItemsRequested" EnableViewState="false"  
    OnSelectedIndexChanged="cbo_SelectedIndexChanged" 
    OnClientDropDownOpening="cboOpening"> 
</telerik:RadComboBox> 

C#:
protected void Page_Load(object sender, EventArgs evt) 
{ 
    if (!Page.IsPostBack) 
    { 
        cbo.Items.Clear(); 
        cbo.Items.Add(new RadComboBoxItem(some_text)); 
            cboHEs.SelectedIndex = 0; 
    } 
} 
 
 
public void cbo_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs evt) 
{ 
    SessionMgr.ValidateSession(); 
    LoadCBO(); 
} 
 
 
protected void cbo_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs evt) 
{ 
    string selectedText = cbo.Text; 
    if ((selectedText != null) && (selectedText .Trim().Length > 0)) 
    { 
         // Do some stuff... 
    } 
} 
 
 
protected void LoadCBO() 
{ 
    cbo.Items.Clear(); 
 
    foreach (Object obj in ObjectList) 
    { 
        RadComboBoxItem item = new RadComboBoxItem(obj.ToString()); 
 
        cbo.Items.Add(item); 
 
        if (_someCondition_) 
        { 
            item.CssClass = "NewOverrideClass"; 
        } 
    } 
} 

Finally the CSS:
.RadComboBoxDropDown_CustomSkin .NewOverrideClass 
{ 
    background-image: url('image.gif'); 
    background-repeat: no-repeat; 
    background-position: top right; 
    padding: 2px 6px; 
    margin: 0 1px; 
} 
 
.RadComboBoxDropDown_CustomSkin .rcbHovered // <-- This is the default hover class 
{ 
    padding: 1px 18px 1px 5px; 
    border: 1px solid #bcd2f1; 
    background: #e7f1ff; 
    color: #0f3789; 
} 
 

I've tried overriding by trying CSS inheritance (probably wrong)...

.RadComboBoxDropDown_CustomSkin .NewOverrideClass .rcbHovered
{
padding: 1px 18px 1px 5px;
border: 1px solid #bcd2f1;
background: #e7f1ff;
color: #0f3789;
}

Any help is appreciated!
-Allen

Allen Smothers
Top achievements
Rank 2
 answered on 09 Dec 2009
1 answer
127 views
Hi Guys !

I have been using RAD FILE EXPLORER as am important control in my Project for a quite some while.

When I try to delete the file or any folder , it pops -out the DELETE Confirmation Box with 'UPLOAD' written at the TOP.

Since it is performin th REQUIRED action, nothin to worry for me, BUT the issue is that I want 'DELETE' instead of 'UPLOAD'

as shown in the pic I have attached/as shown in your DEMO example.

Plz help !!
Fiko
Telerik team
 answered on 09 Dec 2009
4 answers
120 views
Hi,

I have a Tree within a Dock. What we do is drag a node from the tree and drop it somewhere outside of the dock. The tree is far taller than the dock is, so users have to scroll within the dock to navigate the tree and get to the node they want, which is fine. However, once the dragging operation has started, dragging the node above or below the tree will make it to scroll up or down. Seeing as how in most cases, we drag a node and drop it below the dock (thus below the tree), the result is that each time the dock/tree scrolls all the way down and we have to manually scroll up back to the node we just dragged.

Is it possible to prevent scrolling when dragging a node?

Thanks
Simon Hancock
Top achievements
Rank 1
 answered on 09 Dec 2009
1 answer
103 views
Hello,

I'm trying to bind a Panel Bar with data from 3 tables with Foreign Key relationship.

Departments  --> Categories   --->    Products
---------------------------------------------------------
DepartmentId     CategoryId              ProductId
Name                 DepartmentId(fk)    CategoryId(fk)
                           Name                     Name

I access these tables via methods:
  • LoadDepts();
  • LoadCategories(int deptId);
  • LoadProducts(int catId);

I can bind to the panel bar like this and return a list of departments.  But I'm having problems getting the categories to persist as PanelBarItems.
Departments depts = new Departments();  
depts.Load();  
  
pnlbarDepartments.DataSource = depts;  
pnlbarDepartments.DataTextField = "DisplayText";  
pnlbarDepartments.DataValueField = "ID";  
pnlbarDepartments.DataBind(); 

I've come aross this post referencing this example explaining manual creation of the panel bar items.  The example shows how to do this using an OleDbDataAdapter.

How can I create this scenario using my methods ?
OR
Is there an alternative way of doing this ?

Thank you in advance,
Ronnie
Veselin Vasilev
Telerik team
 answered on 09 Dec 2009
2 answers
186 views

In Mozilla Firefox and Google Chrome on a DropDownList of a RadComboBox the list is displayed below the flash, in Internet Explorer it works correctly.  Also the same thing happens with RadDatePicker
How can achieve the compatibility with Firefox and Google Chrome

    <div>
    <telerik:RadComboBox ID="RadComboBox1" AllowCustomText="true"  runat="server">
   <Items>
       <telerik:RadComboBoxItem runat="server" Text="-- Select item --" />
       <telerik:RadComboBoxItem runat="server" Text="Item with No Value" />
       <telerik:RadComboBoxItem runat="server" Text="Item with Value=1" Value="1" />
       <telerik:RadComboBoxItem runat="server" Text="Item with Value=2" Value="2" />
   </Items>
</telerik:RadComboBox>
    </div>
     <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
           codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24"
           width="1000" height="78">
    <param name="movie" value="header_v8.swf?button=1" />
    <param name="quality" value="high" />
    <param name="menu" value="false" />
    <!--[if !IE]> <-->
    <object data="header_v8.swf?button=1"
            width="1000" height="78" type="application/x-shockwave-flash">
     <param name="quality" value="high" />
     <param name="menu" value="false" />
     <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />    
    </object>
    <!--> <![endif]-->
   </object>

Yana
Telerik team
 answered on 09 Dec 2009
1 answer
109 views
Greetings,

We have implemented the load on demand using webservice feature of the RADMenu, but it blows up with the following error:
Microsoft JScript runtime error: 'this._slide' is null or not an object

Our implementation follows the examples exactly, and I have verified using Trace.WriteLineIf() that there are indeed 12 RadMenuItemData objects for the menu to use.

Any ideas?
T. Tsonev
Telerik team
 answered on 09 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?