Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
289 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
132 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
553 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
92 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
1 answer
74 views
Dear Telerik Team,

How I can define default colors for lineseries??


Thanks,
Aewin.
Peshito
Telerik team
 answered on 10 Oct 2011
5 answers
92 views
Hi,

I have a very basic chart with Dates on the X axis and percentages on the Y axis. I have the scale set to Auto like this:

 

 

 

 

<YAxis AutoScale="True" IsZeroBased="false">

The chart renders with % values of -5000% to +5000%. Ok, so I understand there is no delta between the min and max so the autoscale doesn't have anything to work with. So I attempted to manually set the scale IF all the values are equal. I did this in the PreRender event. But now, the chart does indeed have the proper manually set min scale %, but the max scale % is not visible. Ideas ?

Protected Sub RadChart1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadChart1.PreRender
  
        Dim TheMinValue As Double
        Dim TheMaxValue As Double
        Dim TheValue As Double
  
        'Loop through each Y value in series 0 and get it's value. We need to get the 
        'Min and Max values for the entire chart.
        'For seriescount As Integer = 0 To RadChart1.Series.Count - 1
        For itemcount As Integer = 0 To RadChart1.Series(0).Items.Count - 1
            TheValue = RadChart1.Series(0).Item(itemcount).YValue
  
            'assign default values in the 1st iteration of the loop
            If itemcount = 0 Then
                TheMinValue = TheValue
                TheMaxValue = TheValue
            End If
  
            If TheValue < TheMinValue Then TheMinValue = TheValue
            If TheValue > TheMaxValue Then TheMaxValue = TheValue
        Next
  
  
        If TheMinValue = TheMaxValue Then
            'we have a problem because all Y values are equal. This is going to destroy the 
            'chart scaling along the left hand side.
  
            'The below solution does not seem to work.
            RadChart1.Series(0).PlotArea.YAxis.AutoScale = False
            RadChart1.Series(0).PlotArea.YAxis.MinValue = TheMinValue * 0.95
            RadChart1.Series(0).PlotArea.YAxis.MaxValue = TheMaxValue * 1.05
            RadChart1.Series(0).PlotArea.YAxis.Step = 5
        Else
            RadChart1.Series(0).PlotArea.YAxis.AutoScale = True
        End If
  
    End Sub
Thank you !
Paul

Evgenia
Telerik team
 answered on 10 Oct 2011
1 answer
93 views
I apologize in advance if maybe I'm just missing something obvious, but can't figure this out.  I have a rotator which I want to display only one item at a time, but it seems that when it slides to the next item, it is not lined up correctly and sometimes displays the content of two items at once.  I've attached an image as an example, and the code is below.  How can I make sure it only displays one item, similar to the rotator under the Twitter demo of the Notification control?  Thank you in advance.

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
      </telerik:RadScriptManager>
    
   <telerik:RadRotator ID="AlertsRotator" runat="server" RotatorType="Buttons" Height="200px" ItemHeight="200px" ScrollDirection="Left"
              Width="500px"  ItemWidth="500px">
            <ItemTemplate  >
             
            <div style="text-align: left">
                   <table width="480px">
              <tr>
                  <td align="Center"><strong><%# DataBinder.Eval(Container.DataItem," UserNotificationSubject") %></strong></td>
              </tr>
              <tr>
                  <td align="left"><%# DataBinder.Eval(Container.DataItem,"UserNotificationMessage") %></td>
              </tr>
              <tr>
                  <td>
                  <input type="button" value="click me" onclick="alert('<%# DataBinder.Eval(Container.DataItem,"UserNotificationSeqNum") %>')" /></td>
              </tr>
            </table>
                </div>
         
            </ItemTemplate>
          </telerik:RadRotator>
Public Partial Class Rotator
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim oData As New DataTable
        With oData
            .Columns.Add("UserNotificationSubject")
            .Columns.Add("UserNotificationMessage")
            .Columns.Add("UserNotificationSeqNum")
        End With
 
        Dim NewRow As DataRow = oData.NewRow
        NewRow("UserNotificationSeqNum") = "0"
        NewRow("UserNotificationSubject") = "Test User Notification Subject"
        NewRow("UserNotificationMessage") = "Test User Notifcation Message"
        oData.Rows.Add(NewRow)
 
        NewRow = oData.NewRow
        NewRow("UserNotificationSeqNum") = "1"
        NewRow("UserNotificationSubject") = "REMINDER"
        NewRow("UserNotificationMessage") = "Document T1 Reminder: I'm testing the reminders (To cancel this reminder use 20 on Document)"
        oData.Rows.Add(NewRow)
 
        NewRow = oData.NewRow
        NewRow("UserNotificationSeqNum") = "2"
        NewRow("UserNotificationSubject") = "REMINDER"
        NewRow("UserNotificationMessage") = "Document T1 Reminder: I'm testing the reminders adslfjkasd;lfja;ld jf;ladjf; lakjfd;askf jal;sdjf ;lasdjf;askjf;lka"
        oData.Rows.Add(NewRow)
 
        NewRow = oData.NewRow
        NewRow("UserNotificationSeqNum") = "3"
        NewRow("UserNotificationSubject") = "Web Entry Stuff"
        NewRow("UserNotificationMessage") = "The following document has been entered through the UI"
        oData.Rows.Add(NewRow)
 
 
        AlertsRotator.DataSource = oData
        AlertsRotator.DataBind()
    End Sub
 
End Class
Slav
Telerik team
 answered on 10 Oct 2011
1 answer
145 views
how can i load radtreeview in radcombobox with lazyload data binding???
and just end node clickable in treeview.
please help me
Shinu
Top achievements
Rank 2
 answered on 10 Oct 2011
7 answers
85 views
Greetings,

i use a RadGrid with insert/edit/delete functionalities.
I would like to be sure the user fills all the fields when he tries to insert a new row / update a row

how can i manage to do this ?
thank you in advance!
Adigard
Top achievements
Rank 1
 answered on 10 Oct 2011
3 answers
102 views

Charts are bound to a class.  2 doubles and 1 date.  The doubles are the y-axis series and the date is the x-axis

See the attached file for how it looks. LayoutMode is set to inside which moves the points but not the label.

Here is the code for the 1st chart:

<div class="chartleft">
     
   <telerik:RadChart ID="RadChart1" runat="server" DefaultType="Line" ChartTitle-TextBlock-Text="Last 10 Updates" Width="525">
      <PlotArea>
         <Appearance Dimensions-Margins="18%, 30%, 25%, 10%">
         </Appearance>
         <EmptySeriesMessage Visible="True">
            <Appearance Visible="True">
            </Appearance>
         </EmptySeriesMessage>
          <YAxis IsZeroBased="false">
          </YAxis>
          <XAxis LayoutMode="Inside" AutoScale="false" LabelStep="1" DataLabelsColumn="date" >
              <Appearance ValueFormat="ShortDate" MajorGridLines-Visible="false" >
                  <LabelAppearance RotationAngle="45" Position-AlignedPosition="Top">
                  </LabelAppearance>
              </Appearance>
          </XAxis>
      </PlotArea>
        
      <Series>
          <telerik:ChartSeries DataYColumn="realvalues" Name="Real Values" Type="Line">
          </telerik:ChartSeries>
          <telerik:ChartSeries DataYColumn="othervalues" Name="Trending Values" Type="Line">
          </telerik:ChartSeries>
      </Series>
        
   </telerik:RadChart>
</div>

here is the class it is bound to:

public class chartdata
   {
   public double realvalues { get; set; }
   public double othervalues { get; set; }
   public double date { get; set; }
   public chartdata(double r, double o, DateTime dt)
      {
      date = dt.ToOADate();
      realvalues = r;
      othervalues = o;
      }
   }


 

 

 

 



Evgenia
Telerik team
 answered on 10 Oct 2011
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?