Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
1.1K+ views
Hi,
I am novice to telerik and getting some problem in radcombobox. my scenario is:
- A RadPanelBar
- A RadPanelItem inside the RadPanelBar
- In ItemTemplate of RadPanelItem, I have a RadGrid having columns for Institution, Grade, Degree.
- Inside RadGrid, I've a FormTemplate in which i've place text fields for Institution and Grade and a RadComboBox for Degree (MBA, BBA, etc. fetching from DB).
- My DB design is as I've a Candidate table in which there is a column for Degree (of number type, a foriegn key for my Degrees table).
- I want to show in my RadGrid the Institution, Grade, and Degree_Name (MBA, BBA, etc.), But i cannot understand how to achieve this.
- Another problem is that I am unable to use the selectedValue of RadComboBox.

Please refer to my code snippet.

 

<telerik:RadPanelItem runat="server" Text="Step 5: Qualification >>>">
  
<Items>
  
<telerik:RadPanelItem runat="server" Value="QualificationItem">
  
<ItemTemplate>
  
<div id="QualificationDetail" class="CVPanelGrid" >
  
<telerik:RadGrid ID="QualificationGrid" runat="server" AutoGenerateColumns="False" 
  
CellSpacing="0" GridLines="None" Skin="Web20" 
  
ondeletecommand="QualificationGrid_DeleteCommand" 
  
oninsertcommand="QualificationGrid_InsertCommand" 
  
onneeddatasource="QualificationGrid_NeedDataSource" 
  
onprerender="QualificationGrid_PreRender" 
  
onupdatecommand="QualificationGrid_UpdateCommand" 
  
onitemdatabound="QualificationGrid_ItemDataBound">
  
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
  
</HeaderContextMenu>
  
  
<MasterTableView CommandItemDisplay="Top" EditMode="PopUp" EditFormSettings-EditColumn-CancelImageUrl="images/CancelRecord.gif" EditFormSettings-EditColumn-InsertImageUrl="images/InsertRecord.gif" EditFormSettings-EditColumn-ButtonType="ImageButton" DataKeyNames="PKEY" AllowAutomaticInserts="False">
  
  
<CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Add Qualification" ShowAddNewRecordButton="true" ShowRefreshButton="false" >
  
  
</CommandItemSettings>
  
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
  
<HeaderStyle Width="20px" />
  
</RowIndicatorColumn>
  
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
  
<HeaderStyle Width="20px" />
  
</ExpandCollapseColumn>
  
  
<Columns>
  
<telerik:GridBoundColumn FilterControlAltText="Filter PKey column" 
  
UniqueName="PKey" DataField="PKEY" HeaderText="PKey" HeaderStyle-Width="250" Visible="false">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridBoundColumn FilterControlAltText="Filter Institute column" 
  
UniqueName="Institute" DataField="INSTITUTION" HeaderText="Institute" HeaderStyle-Width="250">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridBoundColumn FilterControlAltText="Filter Degree column" 
  
UniqueName="Degree" DataField="NAME" HeaderText="Degree" HeaderStyle-Width="150">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridBoundColumn FilterControlAltText="Filter CompletionYear column" DataFormatString ="{0:yyyy}" 
  
UniqueName="CompletionYear" DataField="COMPLETION_YEAR" HeaderText="Year of Completion" HeaderStyle-Width="100">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridBoundColumn FilterControlAltText="Filter Major column" 
  
UniqueName="Major" DataField="MAJOR" HeaderText="Major" HeaderStyle-Width="150">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridBoundColumn FilterControlAltText="Filter Grade column" 
  
UniqueName="Grade" DataField="GRADE" HeaderText="Grade" HeaderStyle-Width="150">
  
<HeaderStyle HorizontalAlign="Center" /> 
  
</telerik:GridBoundColumn>
  
  
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderStyle-Width="15px">
  
<HeaderStyle Width="15px" />
  
<ItemStyle HorizontalAlign="Center" />
  
</telerik:GridEditCommandColumn>
  
<telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete" HeaderStyle-Width="15px">
  
<HeaderStyle Width="15px" />
  
<ItemStyle HorizontalAlign="Center" /> 
  
</telerik:GridButtonColumn>
  
</Columns>
  
<EditFormSettings CaptionFormatString="Qualification Details" PopUpSettings-Modal="true" EditFormType="Template" PopUpSettings-Width="480px" >
  
<FormTemplate>
  
<div id="QualificationForm" >
  
<ul ID="QualificationInfo" class="formModalList">
  
<li>
  
<asp:Label ID="Label24" runat="server" CssClass="CVtextLabel" Text="Institution:" 
  
Width="120px"></asp:Label>
  
<asp:TextBox ID="txtInstitute" Text= '<%# Bind("INSTITUTION") %>' runat="server" CssClass="CVtextInput"></asp:TextBox
  
</li>
  
<li>
  
<asp:Label ID="Label25" runat="server" CssClass="CVtextLabel" 
  
Text="Degree:" Width="120px"></asp:Label>
  
<telerik:RadComboBox ID="cmbDegree" runat="server" Skin="Web20"
  
</telerik:RadComboBox
  
</li>
  
<li>
  
<asp:Label ID="Label26" runat="server" CssClass="CVtextLabel" 
  
Text="Year of Completion:" Width="120px"></asp:Label>
  
<telerik:RadMonthYearPicker ID="txtCompletionYear" Runat="server"
  
Culture="English (United States)" EnableTyping="False" Skin="Web20" 
  
DbSelectedDate='<%# Bind ("COMPLETION_YEAR") %>'>
  
<DatePopupButton HoverImageUrl="" ImageUrl=""
  
ToolTip="Open the year view popup." />
  
<DateInput DateFormat="yyyy" DisplayDateFormat="yyyy" ReadOnly="True" runat="server">
  
</DateInput>
  
</telerik:RadMonthYearPicker>
  
</li>
  
  
<li>
  
<asp:Label ID="Label20" runat="server" CssClass="CVtextLabel" Text="Major:" 
  
Width="120px"></asp:Label>
  
<asp:TextBox ID="txtMajor" Text= '<%# Bind("MAJOR") %>' runat="server" CssClass="CVtextInput"></asp:TextBox>
  
</li>
  
  
<li>
  
<asp:Label ID="Label22" runat="server" CssClass="CVtextLabel" Text="Grade:" 
  
Width="120px"></asp:Label>
  
<asp:TextBox ID="txtGrade" Text= '<%# Bind("GRADE") %>' runat="server" CssClass="CVtextInput"></asp:TextBox>
  
</li>
  
  
<li class="lastListItem"
  
<telerik:RadButton ID="BtnAddQualification" runat="server" Text='<%# IIf (TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>'
  
Skin="Web20" Width="50px" CssClass="btnInsertItem" 
  
CommandName='<%# IIf (TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>'>
  
</telerik:RadButton
  
<telerik:RadButton ID="BtnCancelQualification" runat="server" Text="Cancel"
  
Skin="Web20" Width="50px" CssClass="btnCancelItem" CommandName="Cancel" 
  
>
  
</telerik:RadButton>
  
</li>
  
</ul>
  
</div>
  
</FormTemplate>
  
  
  
<FormTableButtonRowStyle HorizontalAlign="Right" /> 
  
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
  
  
</EditColumn>
  
<PopUpSettings Modal="True" Width="480px" />
  
</EditFormSettings>
  
</MasterTableView>
  
<FilterMenu EnableImageSprites="False">
  
</FilterMenu>
  
  
  
  
</telerik:RadGrid>
  
<br /> 
  
</div>
  
</ItemTemplate>
  
</telerik:RadPanelItem>
  
</Items>
  
</telerik:RadPanelItem>

Here you can see that I've not bind my cmbDegree combobox with the DB. I am performing this task in code.

 

 

 

Protected Sub QualificationGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
        If TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then
            Dim editedItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
            Dim cmbDegree As RadComboBox = editedItem.FindControl("cmbDegree")
  
            Dim srv As New PICT.Web.Services.Careers.CareersClient
            Dim dSet As Global.PICT.Web.CVDataSet = srv.GetDegrees()
  
            cmbDegree.DataSource = dSet.Degree
            cmbDegree.DataTextField = "NAME"
            cmbDegree.DataValueField = "PKEY"
            cmbDegree.DataBind()
        End If
    End Sub

The above code sets the data source of cmbDegree and correctly shows when i add new record in the grid through Pop-up modal box. But when i hit insert button, the selected value of combo box not saved in my datatable and not reflect in my grid. (Remember i want to show the Degree Name in the grid, not the selectedvalue of combo.)

Kindly help me out in this matter.

Regards,
Ovais

Majoy
Top achievements
Rank 1
 answered on 15 Sep 2016
1 answer
38 views
There are 15 different downloads available and no description. Fortunately I have a Virtual so I can go through the tedious process of downloading, installing & reverting back to my snapshot. But this is entirely unnecessary and would save your support team and your customers consider time just to add a short description.
Yana
Telerik team
 answered on 15 Sep 2016
1 answer
77 views

Does anyone know how to get a Weighted Average Aggregate out of the PivotGrid?

 

Thanks,

 

Erik

Maria Ilieva
Telerik team
 answered on 15 Sep 2016
4 answers
158 views

version 2013.3.1015.45

I will try and keep this simple we are working on moving our product into foreign markets. To do so means we need to start supporting dates in different formats. In the test I am working with I am attempting to use GridDateTimeColumn to present editable data in an Australian format (ie. dd/mm/yyyy).
The Date is displayed correctly, however when you attempt to batch edit the cell by clicking the date the date in the input field of the RadDatePicker.

In short "31/8/2016" becomes "8/7/2018". Any thoughts?

Eric
Top achievements
Rank 1
 answered on 15 Sep 2016
3 answers
66 views

Hello,

I have a radeditor on a basic page and it works fine so I know the issue is not with my computer, browser, etc.  However, I have one page where the editor loads and I can type, but none of the formatting buttons make any difference and nothing I copy and paste into the editor shows up.  All the other controls (grids, buttons, dropdowns, etc.) appear to work fine on the page.  Here is my code:

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
        <script type="text/javascript">
 
            function rowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
 
            function onPopUpShowing(sender, args) {
                args.get_popUp().className += " popUpEditForm";
            }
 
            function clientClose(sender, args) {
                if (args.get_argument() != null) {
                    //alert("'" + sender.get_name() + "'" + " was closed and returned the following argument: '" + args.get_argument() + "'");
                }
            }
 
        </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="false" />
 
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdPrice">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdPrice" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                     
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
 
 
 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
 
        <div class="div-table">
 
            <telerik:RadDropDownList Width="400px" runat="server" ID="ddlStrategies" RenderMode="Lightweight"
                DataTextField="Name" DataValueField="StrategyID" AutoPostBack="true" OnSelectedIndexChanged="ddlStrategies_SelectedIndexChanged" />
              <telerik:RadButton Skin="Office2010Silver" ID="btnSaveStrategy" runat="server" Text="Save Strategy" OnClick="btnSaveStrategy_Click" />
            <br /><br /><br />
 
            Supplier: <asp:Label ID="lblSupplier" runat="server" /><br />
 
        </div>
         
 
        <div style="display: inline-block;">
            <div>
                <telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1"  Orientation="HorizontalTop" Width="100%" SelectedIndex="0" MultiPageID="RadMultiPage1" Skin="Telerik">
                    <Tabs>
                        <telerik:RadTab Text="Background" />
                        <telerik:RadTab Text="Tab2" />
                        <telerik:RadTab Text="Tab3" />
                        <telerik:RadTab Text="Tab4" />
                        <telerik:RadTab Text="Tab5" />
                    </Tabs>
                </telerik:RadTabStrip>
 
 
                <telerik:RadMultiPage runat="server" ID="RadMultiPage1"  SelectedIndex="0" CssClass="multiPage" Width="100%">
                    <telerik:RadPageView runat="server" ID="RadPageView1">
                        <br />
                        <telerik:RadButton runat="server" ID="btnSaveBackground" Skin="Office2010Silver" AutoPostBack="true" Text="Save" OnClick="btnSaveBackground_Click" /><br /><br />
 
                        <telerik:RadEditor ContentAreaMode="Div"  MaxHtmlLength="1450" RenderMode="Lightweight" Skin="Office2010Silver" ID="edtBackground" runat="server" Width="950px" Height="500px"></telerik:RadEditor
 
                         
 
                    </telerik:RadPageView>
 
...

 

Any help would be greatly appreciated.  I even tried taking out the ajax panel and that didn't work. 

 

Ianko
Telerik team
 answered on 15 Sep 2016
1 answer
179 views

Hello I am trying to have a RadMaskedTextBox allow the user to type an SSN, with the caveat that they must be allowed to hit spacebar (whitespace) or the prompt character X.  The idea is to  have a wildcard search.

So I tried with the simple example:

<telerik:RadMaskedTextBox ID="txtSearchSSN" DisplayMask="XXX-XX-XXXX" Mask="###-##-####" PromptChar="X" runat="server" />

However this did *not* allow whitespace like the documentation suggested, and instead would fire a validator off in the control and disallow it.  So I rewrote it lengthier but more explicit so it will include a range from 0-9, X, or a whitespace, like this:

<telerik:RadMaskedTextBox ID="txtSearchSSN" DisplayMask="XXX-XX-XXXX" Mask="<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>-<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>-<0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X><0|1|2|3|4|5|6|7|8|9| |X>" PromptChar="X" AllowEmptyEnumerations="true" runat="server"  />

Now it appears to validate and handle the way I would want, but now whenever I use spacebar (whitespace) to indicate a wildcard it changes the input value to Zero (0) rather than leaving it as the prompt character X.

Am I missing something obvious with this control to do what I want?

So if the user types 548 and then all X or Spaces, I want it to show in the input box as 548-XX-XXXX, but now it shows 548-00-0000 if I use spaces.  Using X as input has it showing properly though.

Any help is appreciated

Thanks!

Maria Ilieva
Telerik team
 answered on 15 Sep 2016
1 answer
83 views

So I have a hierarchical RadGrid with 1 master table and 1 detail table.

The detail table has the property 

<EditFormSettings EditFormType="Template">

The TemplateForm has 1 TextBox and 1 RadAsyncTable and the submit button (insert, update).

Now when I choose a file to upload and hit "insert" the file is uploaded and everything works correctly.

The problem is that when the file exists, I want to display an error message : "the file already exists". So I have a method to verify if the file exists. If this is the case, I want to keep the EditForm opened and display the error message. But when I choose another file that doesn't exist and hit submit again, it looks like the RadAsyncUpload loses its value and the file is gone.

Here is my code:

try {
 UploadedFile file = btn.UploadedFiles[0];
 bool exists = BDD.CheckIfDocumentExists(fileName);
 if (!exists) file.SaveAs(Path.Combine(targetFolder, fileName));
} catch (Exception ex) {
  // log the error
}
 
if (exists) {
 GridEditableItem item = (GridEditableItem) e.Item;
 Label RadTextBox1 = (Label) item.FindControl("lbl_detailerror");
 RadTextBox1.Text = "the file already exists";
 e.Canceled = true;
} else {
 // insert the file in db
}

Konstantin Dikov
Telerik team
 answered on 15 Sep 2016
2 answers
503 views
I have a RadGrid with two date columns and I have added a Calculated Column to get the number of days between them.

I tried a couple of techniques I found from Google to display the number of days but it always displays in this format:  2.00:00:00 for two days.  Fourty days looks like 40.00:00:00.  I just want to display the number of days as an integer like, "2" or "40".

The Calculated column UniqueName="DaysOpen".

One of the techniques I tried did the calculation in the .vb file and was supposed to send the value to a GridTemplateColumn with a <asp:Label /> in the ItemTemplate, but that method didn't work at all.  The column showed no values at all.  The column was there but all the fields were blank.
.aspx
        <telerik:GridCalculatedColumn DataFields="DateResolved,DateReceived" Expression="{0}-{1}" headerstyle-width="50px"
            HeaderText="Days Open" UniqueName="DaysOpen"  Aggregate="None">
        </telerik:GridCalculatedColumn>
 
 
<%--
        <telerik:GridTemplateColumn UniqueName="Temp" HeaderStyle-Width="50px" HeaderText="days open">
            <ItemTemplate>
              <asp:Label ID="DaysOpen" runat="server"></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
--%>


.aspx.vb  -  I commented out both methods because neither of them seemed to do anything.  In or out made no difference to the grid contents at all like they just weren't accessing the grid objects, which is probably the case.  On line 27 I hard coded a "3" in place of the now commented out, [date].ToString and the column was still blank.
Imports Telerik.Web.UI
Partial Class test
    Inherits System.Web.UI.Page
 
    'Protected Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
    '    'grid.MasterTableView.SwapColumns("ComplaintID", "DateReceived")
    'End Sub
 
    'Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
    '    If TypeOf e.Item Is GridDataItem Then
    '        Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
    '        Dim myTS As TimeSpan = TimeSpan.Parse(item("DaysOpen").Text)
    '        item("DaysOpen").Text = [String].Format("{0}h {1}m {2}s", myTS.Days, myTS.Hours, myTS.Minutes)
    '    End If
    'End Sub
 
    '  Both methods of getting the difference between two dates work equally well.
    '  Actually neither of them seem to do shit. When I commented them both out I still got the same correct results, but formatted like this:  2.00:00:00 for two days.
 
    'Protected Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs)
    '    If TypeOf e.Item Is GridDataItem Then
    '        Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
    '        Dim DaysOpen As Label = TryCast(item.FindControl("DaysOpen"), Label)
    '        Dim DateResolved As String = (item("DateResolved").Text)
    '        Dim DateReceived As String = (item("DateReceived").Text)
    '        Dim [date] As Integer = Convert.ToDateTime(DateResolved).Subtract(Convert.ToDateTime(DateReceived)).Days
    '        DaysOpen.Text = "3" ' [date].ToString()
    '    End If
    'End Sub
 
End Class

With my markup and code just as above the DaysOpen column displayes the correct number of days, just in the long format.  I just want to display it as an integer. e.g. "40" not "40.00:00:00"

Thank you!
Meir
Top achievements
Rank 1
 answered on 15 Sep 2016
8 answers
204 views

Hi,

I have a Radgrid with 2 columns freeze and I have enabled the resize columns, Am dynamically populating the grid, The problem is When the columns are more By deafult horizontal scrollbar appears and freezing works fine,But when we have less columns then columns get fixed accordingly and horizontal scrollbar doesnot appear which is correct..However for that less columns when we resize columns horizontal scrollbar appears then freezing doesnot work.
Ultimately Freezing works fine when the horizonatl scrollbar appear by default but doesnot work when we resize columns and horizontal scrollbar appear.
So is there any workaround for this?

Viktor Tachev
Telerik team
 answered on 15 Sep 2016
5 answers
249 views
Hi,

I have a user control in which I am using a RadTabStrip & RadGrid. On tab click I have to update the grid. 

So to ajaxify I am using RadAjaxManager as below
<telerik:RadAjaxManager ID="radAjaxMgr" runat="server" EnableAJAX="true" EnablePageHeadUpdate="false" EnableViewState="false" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="radTabStripInd">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="radTabStripInd" />
                    <telerik:AjaxUpdatedControl ControlID="radGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

When I click on the tab for first time the grid gets refreshed but after that none of the tab click event fire. But when I remove "radTabStripInd" from updated controls the grid refreshes for every tab selection but radTabStrip tab does not change to selected state.

Note: If i use a RadAjaxManager on a master page and RadAjaxManagerProxy on usercontrol everything works but I see the performance issue ( 6 -8 sec to refresh the grid).

Can you please let me know how to fix this issue?

Regards,
Kalyan


Viktor Tachev
Telerik team
 answered on 15 Sep 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?