Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
97 views

Hi All,

I am using RadAjaxManager, RadPanelBar andRadGrid in my user control.

Issue:

1. Click on Webpart and click on "Add new record" in Grid from "FirstTabl" tab at first without clicking on any tab.
    Add Mode and Edit Mode working fine as expected. Showing and populating all control(RadEditor, RadPanel etc.) from the grid properly.
    It works fine.

2. Click on Webpart and then click on any other tab, then click on click on "Add new record". from Grid
    Add Mode and Edit Mode behaves weird. Data not getting populating properly.

Controls inside RadGrid and AjaxManager not initializing properly.
Error: 0x800a138f - JavaScript runtime error: Unable to get property '_preInitialize' of undefined or null reference

After follow the #1 step and then if you work with any Tab its working fine.

Can anyone please help me how resolve this issue ? Why this is happing with TAB and Grid with Ajaxmanager.

Thanks,

Harish Patil

Viktor Tachev
Telerik team
 answered on 20 Jul 2015
3 answers
591 views

I have following RadComboBox that triggers a javascript function which in turn enables a different RadComboBox

<telerik:RadComboBox ID="ddlMode"  runat="Server"  CssClass="selectBox"  AutoPostBack="false"  Width="90"  Font-Size="Small" OnClientSelectedIndexChanged="ddlMode_OnClientSelectedIndexChanged"><Items><telerik:RadComboBoxItem Text="New" Value="0" Selected="true"/><telerik:RadComboBoxItem Text="Edit" Value="1"  />
</Items>
</telerik:RadComboBox>

 

Following is the Javascript called:

function ddlMode_OnClientSelectedIndexChanged(sender, args) {
          debugger;
          var category = $find("<%= ddlPRInfo_ItemCategory.ClientID %>");
          category.enabled = true;
}

But it doesn't work.

Please guide on same..

Aneliya Petkova
Telerik team
 answered on 20 Jul 2015
1 answer
282 views

Probably a very noob question: 

Supposed I have a RadComboBox in the ItemTemplate of a RadDataForm.

The entity "Client" have a column called "genderID", which should be bound to the dataform.

Another entity "DefGender" should be bound to the combobox, with "genderID" as the DataValueField, "genderText" as the DataTextField, and I want to somehow bind the SelectedValue to Client.genderID

How would you do this pragmatically?  It was pretty straight forward in Silverlight, but I couldn't figure this out in ASP.

 Thanks.

Eyup
Telerik team
 answered on 20 Jul 2015
11 answers
284 views
Hi,

I refer to this demo: http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandradasyncupload/defaultcs.aspx?product=grid

I have tried so many times but i just can't seem to get this done. What I am trying to accomplish, if i use this exact demo, is that when i click on the image in that "Image" column it must popup in a window that contains the image that i clicked on but just in a larger scale so that it can be viewed better. So basically just a quick view of the selected image.

Could someone please help me on this?

Regards,
Anel 
Konstantin Dikov
Telerik team
 answered on 20 Jul 2015
2 answers
88 views

Hi, I'm working with a radmenu that has only one root item. The behavior I want is for a user to be able to click on the menu item, get a dropdown with login controls, and use those to log into the site I'm working on. I already set ClickToOpen="true", and I'm using a ContentTemplate for the textboxes, button, and so forth. I've tested my setup in Chrome, IE, and Safari on desktop browsers, and it works exactly the way I want. The problem occurs on mobile browsers (tested on Safari and Chrome for iOS 8, and Chrome for Android). When I go to my site on a smartphone, for example, and tap on a textbox to start entering login credentials, the whole menu closes. When I tested in Chrome on iOS 8, I noticed that the onscreen keys would pop up for a split second, and then go away along with the menu. This makes it impossible to use the login controls on a mobile device.

The client I'm working with insists that the site be mobile-friendly, so I need to figure this out, and would like to be able to use the radmenu control, though I'm open to other options that will achieve the functionality I need.

Here's my markup for the controls (sorry the formatting isn't great):

01.<div class="login-box">
02.   <telerik:RadMenu ID="rm1" runat="server" CssClass="RadMenu" ClickToOpen="true"  OnClientItemOpened="ExternalitemOpened" RenderMode="Classic">
03.      <Items>
04.         <telerik:RadMenuItem runat="server" PostBack="false">
05.            <ContentTemplate>
06.               <div id="loginDropDown">
07.                  <h2>Log In </h2>
08.                  <span class="failureNotification">
09.                     <asp:Literal ID="FailureText" runat="server"></asp:Literal>
10.                  </span>
11.                  <asp:ValidationSummary ID="vdsumLogin" runat="server"   CssClass="failureNotification" ValidationGroup="vdgrpLogin" />
12.                  <div>
13.                     <fieldset>
14.                        <legend>Account Information</legend>
15.                        <p>
16.                           <asp:Label ID="lblUsername" runat="server" AssociatedControlID="txtUserN">Username:</asp:Label>
17.                           <asp:TextBox ID="txtUserN" runat="server" CssClass="textEntry"></asp:TextBox>
18.                           <asp:RequiredFieldValidator ID="rfvUserName" runat="server" ControlToValidate="txtUserN" CssClass="failureNotification" ErrorMessage="Please enter a username" ToolTip="Required field" ValidationGroup="vdgrpLogin">* Required</asp:RequiredFieldValidator>
19.                        </p>
20.                        <p>
21.                           <asp:Label ID="lblPassword" runat="server" AssociatedControlID="txtPassword">Password:</asp:Label
22.                           <asp:TextBox ID="txtPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
23.                           <asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword" CssClass="failureNotification" ErrorMessage="Please enter a password" ToolTip="Required field" ValidationGroup="vdgrpLogin">* Required</asp:RequiredFieldValidator>
24.                        </p>
25.                      </fieldset>
26.                      <p class="submitButton">
27.                         <asp:Button ID="btnLogin" runat="server" CommandName="Login" Text="Log In" ValidationGroup="vdgrpLogin" CssClass="normalButton" OnClick="btnLogin_Click" />
28.                      </p>
29.                   </div>
30.                   <a href="../Register">register</a><br />
31.                   <a href="../Account/ForgotPassword.aspx">forgot password?</a><br />
32.                   <a href="../Account/RetrieveUsername.aspx">forgot username?</a>
33.                </div>
34.             </ContentTemplate>
35.          </telerik:RadMenuItem>
36.       </Items>
37.    </telerik:RadMenu>
38.</div>

Here's the script I'm using:

function ExternalitemOpened(s, e) {
    if ($telerik.isIE8) {
        // Fix an IE 8 bug that causes the list bullets to disappear (standards mode only)
        $telerik.$("li", e.get_item().get_element())
            .each(function () { this.style.cssText = this.style.cssText; });
    }
}

 

​

I'm also setting the text of the root item from code-behind. It tells the user they can click the menu to login or logout, depending on context. If they're currently logged in, then clicking the menu will fire an event handler that will log them out. Selections from that code:

rm1.Items(0).Text = "(logout)"
AddHandler rm1.ItemClick, AddressOf rm1_ItemClick1
 
rm1.Items(0).Text = "(committee login)"
 
Protected Sub rm1_ItemClick1(sender As Object, e As Telerik.Web.UI.RadMenuEventArgs)
   Response.Redirect("~/Account/Logout.aspx")
End Sub
 

Also, the CSS from the markup:

.login-box{
   width:1024px;
   height:50px;
   margin:0 auto;
   margin-top:8px;
   margin-bottom: 8px;
   padding:0;
   background-color:#E6E6E6;
   text-align:left;
}
.login-box h1{
   font-size:1em;
   font-weight:normal;
   letter-spacing:1px;
   margin:0px 0px 0px 20px;
   text-align:left;
   padding-top:15px;
    display:inline-block;
}
.login-box a:hover{
    color:#4AB97B;
}
.RadMenu .rmRootGroup{
    border:none !important;
}
.RadMenu .rmText{
    background-color:#E6E6E6 !important;
    font-size:1em !important;
    font-weight:normal !important;
    letter-spacing:1px !important;
    margin:0px 0px 0px 20px !important;
    text-align:left !important;
    padding-top:12px !important;
}
.RadMenu .rmText:hover{
    color:#4AB97B !important;
}
.RadMenu a.rmSelected{
    background-color:#E6E6E6 !important;
}
.RadMenu .rmLink{
    padding:0 0 0 0px !important;
}
.RadMenu .rmPopup.rmContentTemplate{
    background-color:#E6E6E6 !important;
}
.RadMenu_Default .rmFirst a.rmLink, .RadMenu_Default .rmFirst a.rmLink:hover, .RadMenu_Default .rmLast .rmText,
.RadMenu_Default .rmLast a.rmLink:hover .rmText, .RadMenu_Default .rmVertical a.rmLink, .RadMenu_Default .rmVertical .rmText{
    background-color:#E6E6E6 !important;
    font-size:medium !important;
}
.failureNotification
{
    font-size: 1.2em;
    color: Red;
}
input.passwordEntry
{
    border: 1px solid #ccc;
}
.submitButton
{
    text-align: right;
    padding-right: 10px;
}
.normalButton
{
    color: #FFFFFF;
    border-radius: 30px;
    background-color: #579767;
    border: 2px solid #000000;
    width: 150px;
    height: 30px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: large;
}
.normalButton:disabled
{
    color: #686868;
    border-radius: 30px;
    background-color: #969696;
    border: 2px solid #D1D1D1;
    width: 150px;
    height: 30px;
    font-family: Arial, Helvetica, sans-serif;
    font-style: italic;
    font-size: large;
}
 

And the mobile CSS (where applicable):

@media only screen and (max-width: 768px) {
 
.login-box{
   width:100%;
   height:50px;
   margin:0 auto;
   margin-top:8px;
   margin-bottom: 8px;
   padding:0;
   background-color:#E6E6E6;
   text-align:left;
}
.login-box h1{
   font-size:1em;
   font-weight:normal;
   letter-spacing:1px;
   margin:0px 0px 0px 10px;
   text-align:left;
   padding-top:15px;
}
 
.normalButton
{
   color: #FFFFFF;
   border-radius: 30px;
   background-color: #579767;
   border: 2px solid #000000;
   width: 150px;
   height: 30px;
   font-family: Arial, Helvetica, sans-serif;
   font-size:medium;
}
.normalButton:disabled
{
   color: #686868;
   border-radius: 30px;
   background-color: #969696;
   border: 2px solid #D1D1D1;
   width: 150px;
   height: 30px;
   font-family: Arial, Helvetica, sans-serif;
   font-style: italic;
   font-size:medium;
}
 
}
 

I have spent several hours playing with the markup and searching online for other instances of this issue, with no fix. I looked into using RenderMode="auto" or RenderMode="mobile", but neither worked the way I needed. I am using version 2015.2.623.40 of the web controls.

Please help me get this working on mobile browsers.

Dimitar
Telerik team
 answered on 20 Jul 2015
1 answer
97 views
//ASP.net 
<telerik:RadTimePicker runat="server" ID="rtpStopTime" Width="80px"  ValidationGroup="GridChanges" OnLoad="rtpStopTime_DataBinding"
                                ClientEvents-OnDateSelected="MCRPostShiftStopTimePickerOnTimeSelect">
                                <DateInput ID="DateInput2" runat="server" AutoCompleteType="None" TabIndex="3"></DateInput>
                                <TimeView ID="TimeView2" runat="server" Interval="15" Columns="8" AlternatingTimeStyle-BackColor="#F6F6F9"></TimeView>
                            </telerik:RadTimePicker>

//C#:

protected void rtpStartTime_DataBinding(object sender, EventArgs e)
        {
            RadTimePicker TimeBox = (RadTimePicker)sender;
            TimeBox.TimeView.CustomTimeValues = StartTimeArray; //6:00 - 23:45 Date = '2015/01/01' ; 0:00 - 5:45 Date = '2015/01/02'
        }

function MCRPostShiftStartTimePickerOnTimeSelect(sender, eventArgs) {
 
              //not sending the correct date from customvalues for values over midnight
 
              //alert("Start Time " + eventArgs.get_newValue());
              //alert("Start Date " + eventArgs.get_newDate());
              //var date = eventArgs.get_renderDay().get_date();
              //alert("Start Date " + date);
            
              //var timepicker = sender;
              //alert("timepicker " + timepicker);
              //var selectedDate = timepicker.get_selectedDate().format("yyyy/MM/dd");
              //var selectedTime = timepicker.get_selectedDate().format("HH:mm:ss")
              //alert("Start: " + selectedDate + " " + selectedTime);
 
          }

Maria Ilieva
Telerik team
 answered on 20 Jul 2015
1 answer
735 views

Hello,

I use the OnItemsRequested event  to get the data from database:

Below are design code:

<telerik:RadComboBox ID="ddlItem" runat="server" Width="45%" ZIndex="50000" Height="400px"
                                                DropDownWidth="500px" HighlightTemplatedItems="true" EmptyMessage="[ Search items by typing minimum 2 characters ]"
                                                AllowCustomText="true" MarkFirstMatch="true"  EnableLoadOnDemand="true" OnItemsRequested="ddlItem_OnItemsRequested"
                                                Skin="Office2007" ShowMoreResultsBox="true" EnableVirtualScrolling="true" OnClientItemsRequesting="OnClientItemsRequesting"
                                                CheckBoxes="true" >
                                                <HeaderTemplate>
                                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td style="width: 10%" align="left">
                                                                <asp:Literal ID="Literal1" runat="server" Text="Group"></asp:Literal>
                                                            </td>
                                                            <td style="width: 60%" align="left">
                                                                <asp:Literal ID="Literal2" runat="server" Text="Item Name"></asp:Literal>
                                                            </td>
                                                            <td style="width: 15%" align="right">
                                                                Stock
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </HeaderTemplate>
                                                <ItemTemplate>
                                                    <table style="width: 100%" cellspacing="0" cellpadding="0">
                                                        <tr>
                                                            <td style="width: 10%" align="left">
                                                                <%# DataBinder.Eval(Container,"Attributes['ItemSubCategoryShortName']" )%>
                                                            </td>
                                                            <td style="width: 60%" align="left">
                                                                <%# DataBinder.Eval(Container, "Text")%>
                                                            </td>
                                                            <td style="width: 15%" align="right">
                                                                <%# DataBinder.Eval(Container, "Attributes['ClosingBalance']")%>
                                                            </td>
                                                            <td style="width: 10%; display: none;" align="right">
                                                                <%# DataBinder.Eval(Container, "Attributes['Percentage']")%>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </ItemTemplate>
                                            </telerik:RadComboBox>​

And i use the following code in c#:

 protected void ddlItem_OnItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {

//write login code to get the data from database through ItemRequest event.

}

 

What I want is I use the checkbox to select multiple items or data from drop down and add all the checkboxs true to grid but when i use foreach loop then I can't get the checkbox true items.

Here is the code:

 

 foreach (RadComboBoxItem ComboItem in ddlItem.CheckedItems)
        {
            if (ComboItem.Checked == true)
            {
            }       
}

The above loop is not working when i try to get the checked true items.

 Please help me as soon as possible.

I hope you understand my query.

 

Thanks

Jiten Mutum

Aneliya Petkova
Telerik team
 answered on 20 Jul 2015
1 answer
142 views

multi-column RadComboBox  via a web method. 

ASPX

<telerik:RadComboBox  runat="server" ID="RadComboBox1" Width="200px"
        MarkFirstMatch="true"
        EnableLoadOnDemand="true"
        HighlightTemplatedItems="true"
        DroDownCssClass="exampleRadComboBox">
       <HeaderTemplate>
            <tr>
                <th class="col1">Category Name</th>
             <%--   <th class="col2">Some other column</th>--%>
            </tr>
        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td class="col1">
                    <%# DataBinder.Eval(Container.DataItem, "Category_Name") %></td>
             <%--   <td class="col2">
                    <%# DataBinder.Eval(Container.DataItem, "Some_Other_Col") %></td>--%>
            </tr>
        </ItemTemplate>
          <WebServiceSettings Method="GetCat" Path="Default.aspx" />
</telerik:RadComboBox>

  Code Behind

 

[WebMethod]
       public static RadComboBoxData GetCatType(RadComboBoxContext context)
       {
           var x =
               "[{'CoachingSessionActivityCategoryID':0,'CoachingSessionActivityTypeID':1000005,'Category_Name':'Skills Conditioning','TeamID':0,'ClubID':1,'Type_Name':'Skills Con - Small Sided Games (Attack)'}]";
 
           var data = JsonConvert.DeserializeObject<DataTable>(x);
 
           RadComboBoxData comboData = new RadComboBoxData();
 
 
           var itemOffset = context.NumberOfItems;
           var endOffset = Math.Min(itemOffset + 10, data.Rows.Count);
 
           comboData.EndOfItems = endOffset == data.Rows.Count;
 
           List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(endOffset - itemOffset);
 
           for (int i = itemOffset; i < endOffset; i++)
           {
               RadComboBoxItemData itemData = new RadComboBoxItemData();
               itemData.Text = data.Rows[i]["Category_Name"].ToString();
               itemData.Value = data.Rows[i]["Category_Name"].ToString();
               result.Add(itemData);
 
           }
           comboData.Items = result.ToArray();
           return comboData;
       }

 

The question is: 

1) How do I bind the combobox to the web method?

2) How do I bind multiple columns to the combo box with the web method?

Andrew
Top achievements
Rank 1
 answered on 20 Jul 2015
2 answers
35 views

Hi, 

We're working on an application which has a RadComboBox multiple tiers which can be clicked through. 

Similar to https://www.filamentgroup.com/examples/menus/ipod.html#

Menu 1

Food

Drinks

 

-> Click Food

 Menu 2 appears

Starters

Main

Dessert

-> Click Dessert

 Menu 3 appears

Ice Cream
Meringue with Orange

 

All within the same ComboBox?

Is it possible in UI for ASP.NET AJAX to achieve a similar result out of the box? 

Additionally one of the requirements is the ability to filter the items based on the path. 

So if the user types "Orange" it will bring back results of Meringue with Orange from Food > Dessert menu and Orange Juice from Drinks > Squash menu?

 

I hope that I've made sense.

Andrew
Top achievements
Rank 1
 answered on 20 Jul 2015
2 answers
452 views
I am trying to dynamically add RadButtons to a page by simply sticking the HTML in on the page load.  The buttons are not showing up on the page.  I have tried using AddControl which does display the buttons, but after I call AddControl, I can no longer modify the InnerHtml.  Any ideas how I can make this work?  See Code below.

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsCallback)
            return;

        CompSubMenuDiv.InnerHtml = "";

        int ItemNum = 0;
        AddMenuHTML("Item Title 1",
                    "Item Description 1",
                    "~\\Comparison.aspx", "~\\Comparison.aspx", "~\\Comparison.aspx",
                    ItemNum);

        AddMenuHTML("Item Title 2",
                    "Item Description 2.",
                    "~\\Comparison.aspx", "~\\Comparison.aspx", "~\\Comparison.aspx",
                    ItemNum);

    }


    protected void AddMenuHTML(string ModTitle, string ModDesc,
                               string LearnMoreURL, string SampleURL, string CreateIllURL,
                               int ItemNum)
    {
        // Add the html for one menu item.
        ItemNum++;
        string Button1Name = "RadButton" + Convert.ToString(ItemNum);
        ItemNum++;
        string Button2Name = "RadButton" + Convert.ToString(ItemNum);

        CompSubMenuDiv.InnerHtml = CompSubMenuDiv.InnerHtml + "<br /><br /><br />" +
          "<span class=\"SubMenuItemTitle IISMenuItemText1\">" + ModTitle + "</span><br />" +
          "<div class=\"SysSubMenuLevel2Div\">" +
          "   <div class=\"SubMenuItemDescDiv\">" +
          "       <span class=\"SubMenuItemText\">" + ModDesc + " <a href=\"~\\comparisons.aspx\">learn more...</a> </span>" +
          "       <br />" +
          "       <telerik:RadButton ID=\"" + Button1Name + "\" runat=\"server\" " +
          "           Text=\"Show me a sample case...\"" +
          "           BorderColor=\"Black\" Height=\"1.5em\" ForeColor=\"#666666\" Style=\"padding-top: 2px; " +
          "           padding-bottom: 2px; margin-top: 0.5em; visible: true;\">" +
          "       </telerik:RadButton>" +
          "   </div>" +
          "   <div class=\"SubMenuCreateIllDiv\">" +
          "       <telerik:RadButton ID=\""+Button2Name+"\" runat=\"server\" " +
          "           Text=\"Create Illustration\" BorderColor=\"Black\"" +
          "           Height=\"1.5em\" Style=\"padding-top: 2px; padding-bottom: 2px; margin-top: 0.5em;" +
          "            float: right\" BackColor=\"Gray\" ForeColor=\"White\">" +
          "       </telerik:RadButton>" +
          "   </div>" +
          "</div>";
    }

Ianko
Telerik team
 answered on 20 Jul 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?