Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
2.8K+ views
Is there a way to set a combo box to "empty" on the client? I mean empty like when the page is first loaded with nothing in it and the empty message is showing.

Through client side code I can clear items, clear selection and even set the combo text. But I can not figure out how to get it back to the initial "empty" state through code. If I manually delete the text in the combo box it shows the empty message but I can't seem to set it through code.

I have linked combo's and if the user clears the parent then the child needs to be cleared (set to empty) and disabled.

I have resulted to clearing the items and setting the text to "select an item". My biggest issue is that the text looks different than the empty message text. Users pick up on that stuff.

This seems like an obvious thing to have. It would be nice if there was a method that set the combo to empty like:
combo.set_empty();
I thought the clearItems method would have done this but it just leaves the text in the combo blank.

Any help would be appreciated.

Thanks,
Craig
Shinu
Top achievements
Rank 2
 answered on 13 Jan 2014
2 answers
188 views
I have a procedure that runs in the ItemDataBound event for my grid. It's purpose is to color code a status field by checking the due date and today's date to see if the request is past due.

The due date is being displayed in a GridDateTimeColumn, however, NULL is a valid value in this field. There is no editing in this grid...it's for display purposes only.

I can't seem to figure out how to check in my code behind if there is a date in the GridDateTimeColumn or not. I tried to cast the field as a RadDatePicker using:

DirectCast(item("due_date").Controls(0), RadDatePicker)

but I get an error:

Specified argument was out of the range of valid values.
Parameter name: index

My code behind is in VB. Can you tell me how to check a GridDateTimeColumn for a null value in code behind? Thanks.
Christopher Lee
Top achievements
Rank 1
 answered on 12 Jan 2014
1 answer
58 views

how can I put this grid to edit mode for all cells ?             
 
          
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowEdit="True" DataSourceID="SqlDataSource1"                   OnItemDataBound="RadGrid1_ItemDataBound"                 AllowAutomaticUpdates="True"   AutoGenerateColumns="False" CellSpacing="0" GridLines="None">
                <ClientSettings>
                     <Scrolling AllowScroll="True" />
                </ClientSettings>
                <MasterTableView EditMode="InPlace" CommandItemDisplay="Top" TableLayout="Fixed" AutoGenerateColumns="false">
                 <Columns>
                    <telerik:GridBoundColumn UniqueName="RxNo" HeaderText="RxNo" DataField="RxNo" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Guidid" HeaderText="Guidid" DataField="Guidid">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="MusteriGuidid" HeaderText="MusteriGuidid" dataField="MusteriGuidid">
                    </telerik:GridBoundColumn>
                </Columns>
                </MasterTableView>
            </telerik:RadGrid>

            none of these methods not working for me .

    Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
        If TypeOf (e.Item) Is GridDataItem Then
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem)
            dataItem.Edit = True
        End If
        RadGrid1.Rebind()
    End Sub

    Protected Sub RadGrid1_PreRender(sender As Object, e As EventArgs)
        '  RadGrid1.Rebind()
    End Sub

I want all cells in edit mode. there are some samples about "entering edit mode on click" but I dont want that.

any suggestions please ? my code was working in 2011 radgrid versions but not in 2013...
aykut
Top achievements
Rank 1
 answered on 12 Jan 2014
2 answers
350 views
Hi, i have a databound RadHtmlChart pie.
is there a way to explode a SeriesItem indside PieSeries on mouse hover and un explode on move mouse out?
also, in OnClientSeriesClicked is there a way to parse args.get_seriesData()? all i get is [object][object]
thanks.
Yaniv
Top achievements
Rank 1
 answered on 12 Jan 2014
2 answers
246 views
It is my Vb.net code it works perfectly.
Protected Sub ChkTaxCheckedChanged1(ByVal sender As Object, ByVal e As EventArgs)
  
     Dim chkTax As CheckBox
     Dim gv1 As GridDataItem
     chkTax = TryCast(sender, CheckBox)
     gv1 = DirectCast(chkTax.NamingContainer, GridDataItem)
  
     Dim txtAmount1 As Label
     txtAmount1= CType(gv1.OwnerTableView.ParentItem.FindControl("lblItemAmount"), Label)
  
End Sub


But now I want to achieve the same functionality in clientside using JavaScript. Like :
function ChkTaxCheckedChanged1(sender, args) {
  var check = sender.get_parent()..??????
}

How can I do this?

Please help me thanks in advance.
Faraz
Top achievements
Rank 1
 answered on 12 Jan 2014
6 answers
324 views
hello

is that possible to Close Rad window when press outside it

Best Regards
ahmed
Top achievements
Rank 1
 answered on 12 Jan 2014
2 answers
364 views
Hi,

This is a problem similar to the one I had with the HD button. There is no way to hide those options when not required/needed/wanted through the control properties. I'd like to remove the share option (facebook etc.) from my video player. Setting the height/width to 0 under "Social Share" had no effect. Please advise with the required CSS (where it should just be a boolean propery setting within the control).

Thanks.

Barry
Barry
Top achievements
Rank 1
 answered on 12 Jan 2014
1 answer
94 views
Hi. I need a grid like below image. How can I make this grid? cAn anyone give me an idea?
Thanks in advance.
Jayesh Goyani
Top achievements
Rank 2
 answered on 11 Jan 2014
1 answer
128 views
I have no clue why, but this code was working yesterday and today it doesn't.

I have the following grid:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="Products"
    Skin="Forest" GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" Width="50%">
    <ClientSettings>
         <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" ></Scrolling>
            <ClientEvents OnBatchEditCellValueChanged="CellValueChanged" />
    </ClientSettings>
    <MasterTableView ShowFooter="true" AutoGenerateColumns="False"
        CurrentResetPageIndexAction="SetPageIndexToFirst" DataKeyNames="ID" DataSourceID="Products"
        Dir="LTR" Frame="Border" TableLayout="Auto" EditMode="Batch" BatchEditingSettings-OpenEditingEvent="Click" CommandItemDisplay="None">
        <Columns>
            <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"  ReadOnly="True" UniqueName="ID" />
            <telerik:GridBoundColumn DataField="ProductName" ReadOnly="true" HeaderText="Product" UniqueName="ProductName" />
             
            <telerik:GridTemplateColumn DataField="Quantity" UniqueName="Quantity" HeaderText="Quantity" DataType="System.Int32">                               
                <ItemTemplate>
                    <%# Eval("Quantity")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadNumericTextBox ID="txtQuantity" runat="server" Width="40px" DataType="System.Int32"
                         NumberFormat-DecimalDigits="0" Skin="Forest">
                        <ClientEvents OnBlur="Blur" OnFocus="Focus" />
                    </telerik:RadNumericTextBox>
                </EditItemTemplate>
                <FooterTemplate>                   
                    <telerik:RadNumericTextBox ID="TextBox2" runat="server" Width="40px" DataType="System.Int32" NumberFormat-DecimalDigits="0" Skin="Forest" ReadOnly="True">
                        <ClientEvents OnLoad="Load" />
                    </telerik:RadNumericTextBox>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>

With the following javascript:
<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
        var sumInput = null;
        var tempValue = 0;
        function Load(sender, args) {
            sumInput = sender;
        }
        function Blur(sender, args) {
            sumInput.set_value(tempValue + sender.get_value());
 
        }
        function Focus(sender, args) {           
            tempValue = sumInput.get_value() - sender.get_value();
        }
        function CellValueChanged(sender, args) {
            var row = args.get_row();
            var rowIndex = row.rowIndex;
            var columnName = args.get_columnUniqueName();
            var cell = args.get_cell();
            var oldValue = args.get_cellValue();
            var newValue = '' + args.get_editorValue();
            var key = '' + row.cells[0].textContent
 
            //debugger
            var hc = document.getElementById('<%= ProductHash.ClientID%>');
            if (hc.value == '') {
                if (newValue == "0") {
                    return;
                }
                aProducts = new Array();
                aProducts[key] = newValue;
            }
            else {
                var aProducts = JSON.parse(hc.value);
                if (aProducts == null) {
                    if (newValue == "0") {
                        return;
                    }
                    aProducts = new Array();
                    aProducts[key] = newValue;
                }
                else {
                    aProducts[key] = newValue;
 
                }
            }
            hc.value = JSON.stringify(aProducts);
        }
    </script>
</telerik:RadScriptBlock>

And the following server side code:
    Protected Sub btnProcess_Click(sender As Object, e As EventArgs)
        Try
            'Retrieve total quantity from footer
            Dim footer As GridFooterItem = DirectCast(RadGrid1.MasterTableView.GetItems(GridItemType.Footer)(0), GridFooterItem)
            Dim TotalQty As String = TryCast(footer.FindControl("TextBox2"), RadNumericTextBox).Text
 
.......do some stuff
 
        Catch ex As Exception
            Response.Write(ex.ToString)
        End Try
    End Sub

Yesterday, I was able to populate TotalQty with the value from the footer, but today, it is an empty string. The footer textbox shows a number in it. Server side, I am getting access to the footer textbox, but the Text property is an empty string.

I have no clue why it stopped working.
Steve
Top achievements
Rank 1
 answered on 11 Jan 2014
1 answer
197 views
I have a RadNumericTextbox in the footer of a grid that I use for displaying a running total on a column when in edit mode.
I populate the grid depending upon what the user selects for input. When in edit mode, and they update the quantity column,
the textbox in the footer automatically totals that column.

When I display non-editable data in the grid, I need to be able to manually update the total from the code behind. How can I
gain access to the textbox and set it's value to be displayed?

I tried the following code but it doesn't work. I can access the textbox and set the text property, but it doesn't display.

I have tried this:
     Dim footer As GridFooterItem = DirectCast(RadGrid1.MasterTableView.GetItems(GridItemType.Footer)(0), GridFooterItem)
     Dim TotalQty As RadNumericTextBox = TryCast(footer.FindControl("TextBox2"), RadNumericTextBox)
     TotalQty.Text = dr("TotalQuantity")
 
And, I have tried this:
     Dim TotalQty As RadNumericTextBox = FindControlRecursive(Page, "TextBox2")
     TotalQty.Text = dr("TotalQuantity")

This is the grid:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" DataSourceID="Products"
    Skin="Forest" GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" Width="50%">
    <ClientSettings>
         <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" ></Scrolling>
            <ClientEvents OnBatchEditCellValueChanged="CellValueChanged" />
    </ClientSettings>
    <MasterTableView ShowFooter="true" AutoGenerateColumns="False"
        CurrentResetPageIndexAction="SetPageIndexToFirst" DataKeyNames="ID" DataSourceID="Products"
        Dir="LTR" Frame="Border" TableLayout="Auto" EditMode="Batch" BatchEditingSettings-OpenEditingEvent="Click" CommandItemDisplay="None">
        <Columns>
            <telerik:GridBoundColumn DataField="ID" DataType="System.Int32"  ReadOnly="True" UniqueName="ID" />
            <telerik:GridBoundColumn DataField="ProductName" ReadOnly="true" HeaderText="Product" UniqueName="ProductName" />
             
            <telerik:GridTemplateColumn DataField="Quantity" UniqueName="Quantity" HeaderText="Quantity" DataType="System.Int32">                               
                <ItemTemplate>
                    <%# Eval("Quantity")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadNumericTextBox ID="txtQuantity" runat="server" Width="40px" DataType="System.Int32"
                         NumberFormat-DecimalDigits="0" Skin="Forest">
                        <ClientEvents OnBlur="Blur" OnFocus="Focus" />
                    </telerik:RadNumericTextBox>
                </EditItemTemplate>
                <FooterTemplate>                   
                    <telerik:RadNumericTextBox ID="TextBox2" runat="server" Width="40px" DataType="System.Int32" NumberFormat-DecimalDigits="0" Skin="Forest" ReadOnly="True">
                        <ClientEvents OnLoad="Load" />
                    </telerik:RadNumericTextBox>
                </FooterTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
    <PagerStyle Mode="NextPrevAndNumeric" />
</telerik:RadGrid>
Steve
Top achievements
Rank 1
 answered on 10 Jan 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?