Telerik Forums
UI for ASP.NET AJAX Forum
12 answers
383 views
Hello,

I need to set an initial value to a combo which uses LoadOnDemand with a web service as in your sample.
As the combo items collection is initially empty, I am unable to select the value for my initial choice.

I must says that apart from this little pb, load on demand works perfectly.

CS
Dimitar Terziev
Telerik team
 answered on 10 Oct 2011
1 answer
141 views
Inside repeater i had placed radgrid and a button outside the repeater, when i click on button i want to validation input data inside radgrid control, using javascript.

how to find radtextbox inside radgrid which is in repeater control.

<asp:Repeater ID="rptrGroup" runat="server" OnItemDataBound="rptrGroup_ItemDataBound">
  <ItemTemplate>
   <table class="table_data">
        <tr><td colspan="2">
              <telerik:RadGrid ID="rgdGroup" runat="server" Width="100%" GridLines="Vertical" AutoGenerateColumns="False"  OnItemDataBound="rgdGroup_ItemDataBound"  OnItemCommand="rgdGroup_ItemCommand" CellSpacing="0">                     <MasterTableView DataKeyNames="Id">
                <Columns>
               <telerik:GridCheckBoxColumn HeaderText="Status" DataField="Status" UniqueName="Status">
              </telerik:GridCheckBoxColumn>
              <telerik:GridTemplateColumn HeaderText="Order" DataField="Order" UniqueName="ActionOrder">
              <ItemTemplate>
             <telerik:RadTextBox ID="rtbOrder" runat="server" Text='<%# Eval("Order") %>'  Width="48px" MaxLength="3" />
           </ItemTemplate>
            </telerik:GridTemplateColumn>
           <telerik:GridBoundColumn HeaderText="Item" DataField="ItemName" UniqueName="ItemName">
           </telerik:GridBoundColumn>
          <telerik:GridTemplateColumn HeaderText="Date" DataField="Date" UniqueName="Date">
          <ItemTemplate>
         <telerik:RadDatePicker ID="rdpDate" runat="server" Culture="en-US" Width="100px" SelectedDate='<%# Eval("Date") %>'>
         <Calendar ID="cldrDate" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False"
           ViewSelectorText="x" runat="server" >
        </Calendar>
        <DateInput ID="diDate" DisplayDateFormat="MM/dd/yyyy" DateFormat="MM/dd/yyyy"  runat="server">
         </DateInput>
         <DatePopupButton ImageUrl="~/App_Themes/images/calendar_ico.png" HoverImageUrl="~/App_Themes/images/calendar_ico.png">
         </DatePopupButton>
       </telerik:RadDatePicker>
        </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn HeaderText="Remark" DataField="Remark" UniqueName="Remark">
        <ItemTemplate>
     <telerik:RadTextBox ID="rtbRemark" runat="server" Text='<%# Eval("Remark") %>' />
     </ItemTemplate>
      </telerik:GridTemplateColumn>
      <telerik:GridButtonColumn HeaderText="Active/Inactive" ButtonType="LinkButton" UniqueName="lnkItemActiveInActive"  ItemStyle-VerticalAlign="Middle" CommandName="ItemStatus">
     </telerik:GridButtonColumn>
    </Columns>
    </MasterTableView>
    </telerik:RadGrid>
</td>
 </tr>
 </table>
 </ItemTemplate>
</asp:Repeater>
Princy
Top achievements
Rank 2
 answered on 10 Oct 2011
3 answers
105 views
Hi,
I'd like to show only Group and Ungroup  options on the headercontext menu of a RadGrid so i've done in this way
void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e)
       {
           switch (e.Item.Text)
           {                
               case "Columns": e.Item.Visible = false;break;               
               case "Sort Ascending": e.Item.Visible = false; break;
               case "Sort Descending": e.Item.Visible = false; break;
               case "Clear Descending": e.Item.Visible = false; break;
               case "Clear Sorting": e.Item.Visible = false; break;
                      }
       }
If i leave the "element "Columns visible" it works fine, but if i putcase "Columns": e.Item.Visible = false;break;  i get this error:
Microsoft JScript runtime error: 'findItemByValue(...)' is null or not an object

What is the problem of  hiding the item "Columns" of the context mennu ?

Thank You !!

Iana Tsolova
Telerik team
 answered on 10 Oct 2011
7 answers
102 views
Hi,

I want to attach client side  events to StartDate and StartTime controls inside Advanced Edit Form.
On changing  start time I want to modify end time using javascript fxns, similarly I want to modify end time on changing start time.
Is it possible to overwrite existing fxns.

  function ClientFormCreated(sender, e) {
         var advancedEditStartDate= $telerik.$("[id$='Form_StartDate']");
                      advancedEditStartDate.onchange(function() {
                       ModifyEndDate();
                   });

    var advancedEditStartTime = $telerik.$("[id$='Form_StartTime']");
                     advancedEditStartTime.onchange(function() {
                      ModifyEndTime();
                   });


}



 <telerik:RadScheduler ID="rsTicketsSchedule"      OnClientFormCreated="ClientFormCreated" ..

...
 </telerik:RadScheduler>

Thanks,
Prava
Plamen
Telerik team
 answered on 10 Oct 2011
3 answers
205 views

I am using RadTabstrip with RadMultipage.

I have 3 tabs with 3 pageviews. I am using ContentURL property of pageview to load the page as a main page’s content.

How do I get a reference to Main page’s controls  in content page ?


Thanks!
Dimitar Terziev
Telerik team
 answered on 10 Oct 2011
8 answers
567 views
Hi there,

We currently use RadDatePicker / Calendar to get a user input of the current date. We have followed the tutorials accordingly and setup different rules such as DisplayDateFormat and DateFormat.

We are currently experiencing a problem on certain machines where the DateFormat rule is not followed! (i.e. when the selected date is stored in a property, it is stored in U.S. culture, even though we have explicitly stated that the RadDatePicker use U.K format and that the stored DateFormat is "dd/MM/yyyy")

Is there anything else that we need to set in order to ensure that the properties are applied to all? Would you recommend this is done in code-behind rather than setting it on design-side? What machine settings are likely to override the properties set for the RadDatePicker?

Code attached below:

<telerik:RadDatePicker ID="radDateAssessment" runat="server" Culture="English (United Kingdom)" EnableTyping="True">
<Calendar runat="server" 
UseRowHeadersAsSelectors="False"
UseColumnHeadersAsSelectors="False"
ViewSelectorText="x">
</Calendar>
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton>
<DateInput runat="server" 
 DisplayDateFormat="dd-MMM-yyyy"
DateFormat="dd/MM/yyyy">
    </DateInput>
</telerik:RadDatePicker>


Hope you can be of help

Regards

Ahmed
Maria Ilieva
Telerik team
 answered on 10 Oct 2011
1 answer
354 views
Hi,

 Is it possible to implement progress bar as a column in radgrid? If so how can I do this?

Any sample code would be appreciated.

Thanks
Shinu
Top achievements
Rank 2
 answered on 10 Oct 2011
2 answers
170 views
I tried searching to see what was going on here. I have a user control that is not working right please help me.

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

<%@ Import Namespace="Telerik.Web.UI" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script runat="server">
        void AlbumSetup(object sender, RadListViewItemEventArgs e)
        {
            RadListViewDataItem item = (RadListViewDataItem)e.Item;
            ImageButton Imagebutton = (ImageButton)e.Item.FindControl("AlbumImage");
            HyperLink EditAlbum = (HyperLink)e.Item.FindControl("EditAlbum");
            HyperLink sHyperLink = (HyperLink)e.Item.FindControl("hypShareAlbum");
            HyperLink DeleteAlbums = (HyperLink)e.Item.FindControl("hypeDeleteAlbum");
            HyperLink DeleteAccess = (HyperLink)e.Item.FindControl("hypeDeleteMyAccess");
            HiddenField sharecounter = (HiddenField) e.Item.FindControl("ShareCounter");
            mygreatappz.control.Objects.Album album = item.DataItem as mygreatappz.control.Objects.Album;

            if (album != null)
            {
                if (album.AlbumDefaultImageUrl ==
                    "https://lh5.googleusercontent.com/-d8vnGzfqf_M/TnNs5XN0vfI/AAAAAAAAAEs/sIWhb9-7BE4/s128/no_pic302765EC-7C31-424E-AA45-FC279C6E4A66.png")
                {
                    album.AlbumDefaultImageUrl = "~/SiteImages/no_pic302765EC-7C31-424E-AA45-FC279C6E4A66 (1).png";
                }
                if (DeleteAlbums != null && album.CreatorID == PictureCrave.GlobalClass.GlobalVariables.User.ID)
                {
                    DeleteAlbums.Visible = true;
                }
                else
                {
                    if (DeleteAccess != null)
                    {
                        DeleteAccess.Visible = true;
                    }
                }
                Imagebutton.PostBackUrl = "../SitePages/AlbumView.aspx?aid=" + album.ID;
                EditAlbum.NavigateUrl = "../SitePages/AlbumView.aspx?aid=" + album.ID;
                sHyperLink.Text = string.Format("Share Album ({0})", album.AccessCount);
                sharecounter.Value = album.AccessCount.ToString();
            }
        }
        
        </script>
</telerik:RadCodeBlock>

<div id="divFullControlAlbums">
        <asp:HiddenField runat="server" ID="FullAlbumCounter"/>
            <h2>
                Full control albums:</h2>
                 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ListViewPanel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBoxList1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="0" />
        <asp:Panel ID="ListViewPanel1" runat="server">
                  <telerik:RadListView ID="lvFullControlAlbums" AllowPaging="true" runat="server" GroupItemCount="5" OnItemDataBound="AlbumSetup"
                   >
                  <LayoutTemplate>
                    <table id="Table2" runat="server">
                        <tr id="Tr1" runat="server">
                            <td id="Td3" runat="server">
                                <table id="groupPlaceholderContainer" runat="server" border="0" style="">
                                    <tr id="groupPlaceholder" runat="server">
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr id="Tr2" runat="server">
                            <td id="Td4" runat="server" style="">
                            <telerik:RadDataPager ID="RadDataPager1" runat="server" PagedControlID="lvFullControlAlbums"
                                        PageSize="10">
                                        <Fields>
                                           
                                            <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                           
                                            <telerik:RadDataPagerTemplatePageField>
                                                <PagerTemplate>
                                                    <div style="float: right">
                                                        <b>Items
                                                            <asp:Label runat="server" ID="CurrentPageLabel" Text="<%# Container.Owner.StartRowIndex+1%>" />
                                                            to
                                                            <asp:Label runat="server" ID="TotalPagesLabel" Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
                                                            of
                                                            <asp:Label runat="server" ID="TotalItemsLabel" Text="<%# Container.Owner.TotalRowCount%>" />
                                                            <br />
                                                        </b>
                                                    </div>
                                                </PagerTemplate>
                                            </telerik:RadDataPagerTemplatePageField>
                                        </Fields>
                                    </telerik:RadDataPager>
                            </td>
                        </tr>
                    </table>
                </LayoutTemplate>
                    <EmptyDataTemplate>
                    <table id="Table1" runat="server" style="">
                        <tr>
                            <td>
                                No data was returned.
                            </td>
                        </tr>
                    </table>
                </EmptyDataTemplate>
                <EmptyItemTemplate>
                    <td id="Td1" runat="server" />
                </EmptyItemTemplate>
                
                <ItemTemplate>
                    <td id="Td2" runat="server" style="display: inline-block; position: relative; margin: 0.7em;
                        text-align: left; vertical-align: top;">
                        <asp:HiddenField runat="server" ID="ShareCounter"/>
                        <div id="HypeShareAlbum" style="padding: 0; margin: 0">
                            <input type="hidden" value="<%#Eval("ID") %>" />
                            <asp:HyperLink runat="server" ID="hypShareAlbum"></asp:HyperLink>
                             <input type="hidden" value="<%#Eval("CreatorID") %>"/>
                             </div>
                        <div class="EditAlbumClass">
                            <asp:ImageButton ToolTip='<%#Eval("AlbumDescription") %>' runat="server" ID="AlbumImage" Width="110"
                                Height="110" ImageUrl='<%#Eval("AlbumDefaultImageUrl") %>' /></div>
                        <img src="../SiteImages/private.png" style="margin: 0" />
                        <span style="margin: 0">photos:
                            <%#Eval("PhotoCount")%></span><br />
                        <div id="hypDeleteAccess" style="padding: 0; margin: 0">
                            <input type="hidden" value="<%#Eval("ID") %>" />
                            <asp:HyperLink runat="server" ID="hypeDeleteAlbum" Visible="false" Text="Delete Album"></asp:HyperLink>
                            <asp:HyperLink ID="hypeDeleteMyAccess" runat="server" Visible="false" Text="Remove my Access"></asp:HyperLink>
                            
                        </div>
                        <div  class="EditAlbumClass">
                            <asp:HyperLink runat="server" ID="EditAlbum" ToolTip='<%#Eval("AlbumDescription") %>' Font-Underline="false">
                            <p class="titleAlbums" runat="server" id="pTitle">
                                <%#Eval("AlbumName") %></p>
                        </asp:HyperLink></div>
                    </td>
                </ItemTemplate>
                <GroupTemplate>
                    <tr id="itemPlaceholderContainer" runat="server">
                        <td id="itemPlaceholder" runat="server">
                        </td>
                    </tr>
                </GroupTemplate>
                  </telerik:RadListView>
            </asp:Panel>
            </
            
        </div>
Shinu
Top achievements
Rank 2
 answered on 10 Oct 2011
0 answers
673 views

Please help, i've been tearing my hair out for days on this one !!

I have the autocompleteextender inside a usercontrol as follows :

----------------------------------------------------------------------------------------------------------------------

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AutoControl.ascx.cs" Inherits="FormControls_AutoControl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="DBauer.Web.UI.WebControls.DynamicControlsPlaceholder" Namespace="DBauer.Web.UI.WebControls" TagPrefix="DBWC" %>

<style type="text/css">
/* AutoComplete item */
.AutoComplete2_CompletionList
{
margin: 0px !important;      
background-color: white;            
color: black;            
border: buttonshadow;            
border-width: 1px;            
border-style: solid;            
cursor: 'default';            
overflow: auto;            
height: 200px;            
text-align: left;            
list-style-type: none;            
padding-left: 1px;
}

/*AutoComplete flyout */
.AutoComplete2_CompletionListItem
{
background-color: white;            
color: black;            
padding: 1px;            
cursor: hand;
}

/* AutoComplete highlighted item */
.AutoComplete2_HighlightedItem
{
background-color: #63B8FF;           
color: black;            
padding: 1px;
}

.AutoComplete2_img
{
background-image: url(~/images/autocomplete_leftcap.gif); background-position: right center; background-repeat: no-repeat;
}
</style>

<div id="divRenderEdit" runat="server" >
<asp:TextBox ID="txtValue" runat="server" Width="170px"  CssClass="AutoComplete2_img"></asp:TextBox>

<cc1:AutoCompleteExtender ID="AC1" runat="server"  ServicePath="~/WebService.asmx" ServiceMethod=""  UseContextKey="false"
     CompletionListCssClass="AutoComplete2_CompletionList" 
     CompletionListItemCssClass="AutoComplete2_CompletionListItem" 
     CompletionListHighlightedItemCssClass="AutoComplete2_HighlightedItem"         
     MinimumPrefixLength="1" TargetControlID="txtValue"  CompletionSetCount="20" CompletionInterval="1000"
     OnClientItemSelected="AC1_itemSelected" onclientpopulating="ShowImage" onclientpopulated="HideImage">
</cc1:AutoCompleteExtender>
<asp:Label id="lblRequired" runat="server" Text="*" ForeColor="Red" Visible="False" Font-Bold="True" Font-Size="14pt"></asp:Label>
<asp:HiddenField  ID="hdnID" runat="server" />
<asp:HiddenField ID="hdnAutoCompleteResultSet" runat="server" />
<asp:HiddenField ID="hdnIsRequired" value="N" runat="server" />
</div>
<div id="divRenderDisplay" runat="server" style="display:none;">
    <asp:Label ID="lblValue" runat="server" Text=""></asp:Label>
</div>

<script type="text/javascript">

function AC1_itemSelected(sender, e)
{
    var AC1Value = $get('<%= hdnID.ClientID %>');
    AC1Value.value = e.get_value();
}

function ShowImage()
{   
    var auto_txt = $get('<%= txtValue.ClientID %>');
   
    auto_txt.style.backgroundImage  = 'url(~/images/autocomplete_spinner.gif)';
    auto_txt.style.backgroundRepeat= 'no-repeat';                   
    auto_txt.style.backgroundPosition = 'right';

}
function HideImage()
{
   
    var auto_txt = $get('<%= txtValue.ClientID %>');   
    auto_txt.style.backgroundImage  = 'url(~/images/autocomplete_leftcap.gif)';
}

</script>

-------------------------------------------------------------------------------------------------------------------

The ServiceMethod property is missing as it gets passed in dynamicaly via the property ACResultSet
on a page, just so I can have multiple instances of the control working with different entities, in this case companies and users.

I also have 2 web methods inside the web service as follows

----------------------------------------------------------------------------------------------------------------------

[WebMethod]
    public string[] Company(string prefixText, int count)
    {               
        List<string> titleArList = new List<string>();

        string qry = "select companys.....;
        SubSonic.QueryCommand qc= new SubSonic.QueryCommand(qry);
         
        DataSet ds = SubSonic.DataService.GetDataSet(qc);
       
        for (int i = 0; i < ds.Tables[0].Rows.Count;i++ )
        {
            DataRow row = ds.Tables[0].Rows[i];           
            titleArList.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(row["CompanyName"].ToString(), row["CompanyID"].ToString()));
        }

        return titleArList.ToArray();
    }

[WebMethod]
    public string[] Person(string prefixText, int count)
    {       

        //return all records whose Title starts with the prefix input string        
        List<string> titleArList = new List<string>();

        string qry = "select users.....;
        SubSonic.QueryCommand qc= new SubSonic.QueryCommand(qry);
         
        DataSet ds = SubSonic.DataService.GetDataSet(qc);

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            DataRow row = ds.Tables[0].Rows[i];           
            str.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(row["UserFullName"].ToString(), row["UserID"].ToString()));
        }
        return titleArList.ToArray();
    }

----------------------------------------------------------------------------------------------------------------------

and the 2 instance controls for customers and users are respectively inside their own (usercontrol) pages which make up, with others, one big page when displayed on screen, are as follows :

---------------------------------------------------------------------------------------------------------------------

<uc6:AutoControl ID="CompanyID" runat="server" DisplayName="Company" ValueWidth="250"
isRequired="false" DBField="CompanyID" ACResultSet="Company"/>

<uc6:AutoControl ID="UserID"  runat="server" DisplayName="User" ValueWidth="200"
isRequired="true"  DBField="UserID"  ACResultSet="Person" >

-------------------------------------------------------------------------------------------------------------------- 

now to the knotty problem...........
Both controls work fine in terms of displaying the relevant data....but get this...I noticed a while ago something very strange...

Lets say for simplicity I have 3 companys, 1-Microsoft, 2-Apple, 3-IBM and 3 users 1-Bill Gates, 2-Steve Jobs, 3-Mr IBM (dont know anyone there) and I currently have selected 1-Microsoft and 1-Bill Gates (the two contols are mutually exclusive by the way, NOT linked in ANY logic)
When I change the user to 3-Mr IBM and SAVE the page, what actually happens is that the user control is ignored BUT the company has been saved as 3-IBM !!! (i.e the autocompleteextender has taken the correct ID 3 from the USER list and applied it to the COMPANY control instead !!!  HOW BIZARRE, HOW CAN THIS POSSIBLY BE ???

Ive done a view source on the page to make sure the clientid property of the hidden ID which the autocompleteextender saves the selected items ID to, is in fact distinct (i.e relevant only to its instance, as created) AND IT IS. Also in case you are wondering whether ive blundered elsewhere and simply made a schoolboy error when saving, you'd be wrong, ive checked it...THOROUGHLY.

I'm toying with the idea of creating 2 web services and trying that, dont know why, i'm clutching at straws I guess, I just can't fathom this behaviour. I would be very grateful if anyone could give me a clue to the answer.

Thanks in advance

Simon
Top achievements
Rank 1
 asked on 10 Oct 2011
1 answer
168 views
Upload button is not skinned correctly in any language. Skin=Windows7.
Version Q2 2011 and erlier.
Dobromir
Telerik team
 answered on 10 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?