Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
248 views
I have a related combo box inside a form view insert item template that is returning the error message of "'regionsComboBox' is null or not an object".

I suspect that the issue is related to my use of the $find syntax of the 2nd combo box in the .aspx code, but cannot see it.

Can anyone see/help me with my error?

Here is my .aspx code:
     
    <script type="text/javascript"> 
        var regionsComboBox; 
         
        function pageLoad() { 
            regionsComboBox = $find('<%#((FormView)Container).FindControl("RadComboBox2").ClientID %>'); 
        } 
         
        function LoadRelatedRegions(combo, eventArqs) { 
            var item = eventArqs.get_item(); 
            regionsComboBox.set_text("Loading..."); 
 
            if (item.get_index() > 0) { 
                regionsComboBox.requestItems(item.get_value(), false); 
            } 
            else { 
                regionsComboBox.set_text(" "); 
                regionsComboBox.clearItems(); 
            } 
        } 
         
        function ItemsLoaded(combo, eventArqs) { 
            if (combo.get_items().get_count() > 0) { 
                combo.set_text(combo.get_items().getItem(0).get_text()); 
                combo.get_items().getItem(0).highlight(); 
            } 
            combo.hideDropDown(); //do not open region ddl when populated with regions. 
        } 
    </script> 
     
    <br /><br /> 
     
    <asp:ObjectDataSource ID="ObjectDataSource1"  
                                                OldValuesParameterFormatString="{0}"  
                                                runat="server"  
                                                SelectMethod="GetCountry"  
                                                TypeName="ResumeTableAdapters.ddlCountryTableAdapter"> 
        <SelectParameters> 
            <asp:ControlParameter ControlID="HiddenFieldGUID" Name="UserID" PropertyName="Value" Type="String" /> 
        </SelectParameters> 
    </asp:ObjectDataSource> 
     
    <asp:FormView ID="FormView1"  
                                runat="server"  
                                Caption="Related RadCombo inside a Form View Insert Item Template "  
                                BorderColor="Black"  
                                BorderWidth="1px"  
                                DefaultMode="Insert"  
                                Width="100%" > 
        <InsertItemTemplate> 
             
            <br /><br /> 
             
            <telerik:RadComboBox ID="RadComboBox1"  
                                                     AllowCustomText="false"  
                                                     DataSourceID="ObjectDataSource1"  
                                                     DataTextField="CountryShortNameIntl"  
                                                     DataValueField="CountryID"  
                                                     EnableLoadOnDemand="false"  
                                                     EnableTextSelection="true"  
                                                     EnableVirtualScrolling="true"  
                                                     Filter="StartsWith"  
                                                     Height="325px"  
                                                     HighlightTemplatedItems="true"  
                                                     MarkFirstMatch="true"  
                                                     MaxHeight="325"  
                                                     MaxLength="350"  
                                                     OnClientSelectedIndexChanged="LoadRelatedRegions"  
                                                     RadComboBoxImagePosition="<%$ Resources:Resource, Direction %>"  
                                                     Runat="server"  
                                                     Skin="Black"  
                                                     Width="55%"> 
                <ItemTemplate> 
                    <div style="padding: 2px;"> 
                        <asp:Image ID="ImageInsertCountryFlagIconPath" ImageAlign="AbsMiddle" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "CountryFlagIconPath") %>' Runat="server" SkinID="flag" /> 
                        <asp:Label ID="LabelInsertCountryShortNameIntl" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CountryShortNameIntl") %>' CssClass="genMed" /> 
                    </div> 
                </ItemTemplate> 
            </telerik:RadComboBox> 
             
            <br /><br /> 
             
            <telerik:RadComboBox ID="RadComboBox2"  
                                                     AllowCustomText="false"  
                                                     EnableTextSelection="true"  
                                                     EnableVirtualScrolling="true"  
                                                     ErrorMessage="StartsWith"  
                                                     HighlightTemplatedItems="true"  
                                                     LoadingMessage="Load Moi"  
                                                     MarkFirstMatch="true"  
                                                     OnClientItemsRequested="ItemsLoaded"  
                                                     OnItemsRequested="RadComboBox2_ItemsRequested"  
                                                     RadComboBoxImagePosition="<%$ Resources:Resource, Direction %>"  
                                                     Runat="server"  
                                                     Skin="Black"  
                                                     Width="50%" /> 
             
            <br /><br /> 
             
        </InsertItemTemplate> 
         
    </asp:FormView> 
     

Here is my .cs code:
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
 
    protected void LoadRelatedRegions(string countryID) 
    { 
        ddlRegionTableAdapter regionsTableAdapter = new ddlRegionTableAdapter(); //create regionsTableAdapter. 
 
        RadComboBox RadComboBox2 = (RadComboBox)FormView1.FindControl("RadComboBox2"); 
        RadComboBox2.DataSource = regionsTableAdapter.GetRegion(GetGuid(), Convert.ToInt32(countryID)); //assign the rad combo box datasource to the regionsTableAdapter. 
        RadComboBox2.DataTextField = "RegionNameIntl"; //assign the data text field. 
        RadComboBox2.DataValueField = "RegionID"; //assign the data value field. 
        RadComboBox2.DataBind(); //data bind the rad combo box. 
    } 
 
    protected void RadComboBox2_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
    { 
        // e.Text is the first parameter of the requestItems method  
        // invoked in LoadRegions method  
        LoadRelatedRegions(e.Text); 
    } 
 
    protected Guid GetGuid() 
    { 
        Guid uid = new Guid(Membership.GetUser().ProviderUserKey.ToString()); //assign the users guid (userid) to the uid parameter using Guid.  
        return uid; //return the value;  
    } 
 


Matt
Top achievements
Rank 1
 answered on 04 Sep 2009
2 answers
188 views
Hey,

I am in a big hurry by my boss.  I need a way to find a control that is on a webusercontrol via javascript.  I have tried document.getelementbyid and $find('<% RadControl.ClientId %>') and nothing is working properly.  If anyone can get back to me really quick I would greatly appreciate it.

Kyle
Charlie Crawford
Top achievements
Rank 1
 answered on 04 Sep 2009
2 answers
144 views
Hi,

I have following datetime column:

<

 

telerik:GridDateTimeColumn PickerType="TimePicker" DataField="DrivingMinutesFromLastCity" HeaderText="Driving Time (MM)"

 

 

SortExpression="DrivingMinutesFromLastCity" DataType="System.DateTime" UniqueName="DrivingMinutesFromLastCity" DataFormatString="{0:HH:mm}" >

 

 

</telerik:GridDateTimeColumn>

 


now in the edit / insert form I have to enter only minutes in the form of HH:MM e.g. 00:50 . But in edit mode I have a small timeview button and when i type time 00:50 and press tab it converts it into 12:50 AM on the edit form. Time is represented in correct format (hh:mm) in the grid because i have setup dataformatstring. Now two questions:
1) How can I remove that TimeView button in the Edit mode?
2) How can I setup the input format for datetimecolumn , so that it should enter the time as it is entered e.g. 00:50 and not 12:50 AM.

Your help in this will be highly appreciated.

Cheers,
Ali
Syed M Ali Shah
Top achievements
Rank 1
 answered on 04 Sep 2009
2 answers
85 views
Hello guys,

Im created an OnPopupOpening event for my Calendar control so that when a user clicks on the calendar control, i fire some javascript to control a few radio buttons on the page. The code ive got so far is :

<telerik:RadDatePicker id="radLastApplication" runat="server">
         <ClientEvents OnPopupOpening="setRadioButtonsOnPage();" />
</telerik:RadDatePicker>
 <script type="text/javascript">
       Telerik.Web.UI.Calendar.Popup.prototype.OnClick = function(e) {
            this.Opener.hidePopup();
       }  
 </script>

However with this code, my javascript fires correctly but the calendar wont display!! how can i get the calendar to display as well as fire my little javascript code too?

any help would be greatly appreciated!!

Cheer
Zef

Huzeifa Nabijee
Top achievements
Rank 1
 answered on 04 Sep 2009
0 answers
161 views
hi my friend,
i build an dotnetnuke project an create tabstrip wizard,but when i run my project see this error;
1.Error    1    The type 'System.Web.UI.ScriptManager' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.    ~...\APP_Outlook\Default.ascx.designer.cs    23    59    _APP_Outlook
2.Error    2    The type 'System.Web.UI.IScriptControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.    ~...\APP_Outlook\Default.ascx.designer.cs    32    62    _APP_Outlook

Mostafa Tehrani
Top achievements
Rank 1
 asked on 03 Sep 2009
4 answers
126 views
Hello,
     I upgraded my application to the version 2009.2, out of 2008.2 .
     Now all my combos lists  are off the center of the combobox. In fact they are showing way far the
     combo boxes in any Browser.

     Anyone has an idea why?

    Thanks,



John,
Joao Araujo
Top achievements
Rank 1
 answered on 03 Sep 2009
3 answers
171 views
Hi

I have implemented the radpanel bar, and using the "SPNavigationProvider" i SharePoint (MOSS 2007). I have set PersistStateInCookie to True in order to keep the menu in the right state when clicking on the links in the menu, but when I go to another site which doesn't have the rad panel bar, the panelbar on the page I left will be in the same state as I left when I open that site again. I want the menu to reset to default when I visit other sites. Is that possible?

Another problem that I have is that the menu doesn't expand when I hyperlink from another site. It just stays the way it was. Is it possible to make the menu expand when I link to a "point" in the menu?

Please advise :)

This is my code

<telerik:RadPanelBar  
        Runat="server"   
        DataSourceID="SPNavigationProvider"   
        AllowCollapseAllItems="true" 
        Skin="WebBlue"   
        ExpandMode="SingleExpandedItem"   
        PersistStateInCookie="True" 
        CollapseDelay="300"   
        EnableTheming="True"   
        Font-Bold="False"   
        ExpandDelay="300"   
         EnableViewState="true" 
        Width="215px">  
          
         <CollapseAnimation   
          Type="Linear"   
          Duration="100">  
         </CollapseAnimation> 
          
         <ExpandAnimation   
          Type="None" 
           Duration="100">  
         </ExpandAnimation> 
       </telerik:RadPanelBar> 
         
       <asp:SiteMapDataSource runat="server" ID="SPNavigationProvider" StartFromCurrentNode="true" ShowStartingNode="false"/>  
 

Regards    
    
Adeel
Top achievements
Rank 1
 answered on 03 Sep 2009
4 answers
121 views
This RadDatePicker calendar control works in standard ASP INSERT record form.

          <td style="width:90px;">
            <TRad:RadDatePicker ID="dpDATE_INSTALLATION_INSERT" runat="server"
                                SelectedDate='<%# Bind("DATE_INSTALLATION","{0:d}") %>' AutoPostBack="False">
              <Calendar ID="Calendar2" runat="server" Skin="Outlook" ShowRowHeaders="false"
                        BorderStyle="Solid" BorderWidth="1px" BorderColor="Black"
                        TitleStyle-Backcolor="PaleGoldenrod"></Calendar>
              <DateInput ID="DateInput2" runat="server"
                         DateFormat="dd-MMM-yyyy" DisplayDateFormat="dd-MMM-yyyy" ></DateInput>
            </TRad:RadDatePicker>
          </td> 

In the insert parameter I use the DateTime datatype.

When moved to AJAX Rad Grid form it fails when attempting to insert new record inthe Grid Form with error

"Conversion from string "" to type 'Date' is not valid."

I did not have to handle NULL or zero-length strings before.
Kevin Mason
Top achievements
Rank 1
 answered on 03 Sep 2009
1 answer
36 views
Hi Team,
                I am using Visual studio 2005 for developing web application.
                I need to create user control for telerik chart.I want only instantiate one class that class having all the property
                i just configure that control(class)  like chart tiltle,source...
                How to create that control ?.Is this possible ? Its very urgent
                Kindly send me reply soon

Regards,
Friend
Schlurk
Top achievements
Rank 2
 answered on 03 Sep 2009
3 answers
134 views
Hi,

How can we search for a particular row in a grid and how to highlight the row.

i am using radgrid. i am developing one page for searching the employee details.

first i have bind the grid with data from database.

when i click on the find button it find the employeeid in the grid and highlight the particular row.



thanks,
Justin
Top achievements
Rank 1
 answered on 03 Sep 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?