Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
126 views
Hi,

I have a strange problem with my RadGrid. I placed to RadComboBoxes

<telerik:GridTemplateColumn UniqueName="Dossier" SortExpression="Identification"
    HeaderText="<%$Resources:ESTV.A3, LabelDossier%>" DataField="Identification"
    CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false"
    ShowSortIcon="True">
    <ItemTemplate>
        <a href="<%# Eval("Case.Url") %>">
            <%# Eval("Case.Identification") %></a>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadComboBox runat="server" ID="comboBoxDossier" AllowCustomText="True" EnableLoadOnDemand="True"
            EnableVirtualScrolling="False" AutoPostBack="True" ShowMoreResultsBox="True"
            CausesValidation="False"
            EmptyMessage="<%$Resources:ESTV.A3, MessageSearchForDossierEmpty%>" Skin="Office2010Blue"
            Width="200px" MaxHeight="100px" ItemsPerRequest="50" OnItemsRequested="ComboBoxDossierItemsRequested"
            OnSelectedIndexChanged="ComboBoxDossierOnSelectedIndexChanged">
        </telerik:RadComboBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidatorDossier" runat="server" ControlToValidate="comboBoxDossier"
            ErrorMessage="<%$Resources:ESTV.A3, MessageMandatoryField%>"></asp:RequiredFieldValidator>
    </EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="Address" SortExpression="FullName" HeaderText="Adressen"
    DataField="FullName" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"
    ShowFilterIcon="false" ShowSortIcon="True">
    <ItemTemplate>
        <a href="ViewAddress.aspx?id=<%#Eval("Address.Id") %>">
            <%# Eval("Address.FullName") %>
        </a>
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadComboBox runat="server" ID="comboBoxAddress" AllowCustomText="True" EnableLoadOnDemand="True"
            EnableVirtualScrolling="False" AutoPostBack="True" ShowMoreResultsBox="True"
            CausesValidation="False"
            EmptyMessage="<%$Resources:ESTV.A3, MessageSearchForAddressEmpty%>" Skin="Office2010Blue"
            Width="200px" MaxHeight="100px" ItemsPerRequest="50" OnItemsRequested="ComboBoxAddressItemsRequested"
            OnSelectedIndexChanged="ComboBoxAddressOnSelectedIndexChanged">
        </telerik:RadComboBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidatorAddress" runat="server" ControlToValidate="comboBoxAddress"
            ErrorMessage="<%$Resources:ESTV.A3, MessageMandatoryField%>"></asp:RequiredFieldValidator>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

The Logic about this to ComboBoxes is that if I select a Value from the first one, the second one will automatically filled with the values that are in context with the first one. This is the Code that is in the OnSelectedIndexChanged Method

AddressCaseRelationBll addressCaseRelationBll = new AddressCaseRelationBll();
           AddressBll addressBll = new AddressBll();
           RadComboBox comboBoxDossiers = o as RadComboBox;
 
           if (comboBoxDossiers == null)
           {
               return;
           }
 
           try
           {
               if (string.IsNullOrEmpty(comboBoxDossiers.SelectedValue))
               {
                   List<Address> addresses = addressBll.Select();
                   RadComboBox comboBoxAddress = (RadComboBox)this.radGridAddressCaseRelation.MasterTableView.GetInsertItem().FindControl(ControlAddress);
 
                   comboBoxAddress.Items.Clear();
                   foreach (Address address in addresses)
                   {
                       comboBoxAddress.Items.Add(
                           new RadComboBoxItem(
                               address.FullName, address.Id.ToString()));
                   }
               }
               else
               {
                   List<AddressCaseRelation> addressCaseRelations = addressCaseRelationBll.SelectByCase(new Guid(comboBoxDossiers.SelectedValue));
                   RadComboBox comboBoxAddress = (RadComboBox)this.radGridAddressCaseRelation.MasterTableView.GetInsertItem().FindControl(ControlAddress);
 
                   comboBoxAddress.Items.Clear();
                   if (string.IsNullOrEmpty(comboBoxAddress.SelectedValue))
                   {
                       foreach (AddressCaseRelation addressCaseRelation in addressCaseRelations)
                       {
                           comboBoxAddress.Items.Add(
                               new RadComboBoxItem(
                                   addressCaseRelation.Address.FullName, addressCaseRelation.Address.Id.ToString()));
                       }
                   }
               }
           }

This is working fine, but if I select for example the Value A in the first comboBox, my method will add the all the items  in context with A in the second ComboBox.
Now if i open the second ComboBox see all the correct Items. At the bottom it is an Arrow for load more items.... and here is my problem. everytime when i click this arrow the items are added another time. but if i debug all my method where i have a Items.Add statement it never stops. Now i don't know where this items will bi added.

Regards

Andrey
Telerik team
 answered on 24 May 2012
1 answer
126 views
Following the advice in Veli Pehlivanov's Blog post I'm able to bind to a WCF service I created, however I can not get paging to work.  I'm able to successfully bind to the service, the ListView is pouplated with data,  I just get ALL the data when the page loads.  It doesn't appear to be honoring the AllowPaging or PageSize properties.  Since I'm using an svc-less service I followed the Veli's example for binding to any general JSON feed and the returned JSON is in the format of: 
{
    -"Result": {
        +"Data_Items": [...], 
        "Item_Count": 33
    }
}
 I'm assuming that since I'm getting data the DataPropertyName and DataCountName aren't the issue... but I'm not sure where I'm going wrong. 

Below is the markup for the ListView, the Javascript and CSS I'm using.  Does anyone know what I'm doing wrong?

Markup:
<telerik:RadListView ID="lvPostings" runat="server" AllowPaging="true" PageSize="9">
    <LayoutTemplate>
        <div id="listView">
            <a class="pagePrev" href="javascript:void(0);" title="Go to previous page"></a>
            <a class="pageNext" href="javascript:void(0);" title="Go to next page"></a>
            <div id="items">
            </div>
        </div>
    </LayoutTemplate>
    <ClientSettings>
        <DataBinding ItemPlaceHolderID="items">
            <ItemTemplate>
            <div class="item">
                <span class="name">#= UContactName #</span>
                <span class="company">#= Division #</span>
                <span class="title">#= PositionTitle #</span>
                <br />
            </div>
            </ItemTemplate>
            <EmptyDataTemplate>
                <div class="empty">
                    No Matching Data
                </div>
            </EmptyDataTemplate>
            <DataService Location="http://linkapi/SLogic/Postings/?format=json"
                     HttpMethod="Get" ResponseType="JSONP"
                DataPropertyName="Result.Data_Items" CountPropertyName="Result.Item_Count" />               
        </DataBinding>
        <ClientEvents OnDataBound="onListViewDataBound"  />
    </ClientSettings>
</telerik:RadListView>

Javascript:
<script type="text/javascript">
    var listView;
 
    function pageLoad()
    {
        listView = $find("lvPostings");
    }
 
    (function($)
    {
        $(function()
        {
            $(".pagePrev").click(function(e)
            {
                listView.page(listView.get_currentPageIndex() - 1);
            });
 
            $(".pageNext").click(function(e)
            {
                listView.page(listView.get_currentPageIndex() + 1);
            });
               
        });
    })($telerik.$);
 
    function onListViewDataBound(sender, args)
    {
        $telerik.$(".pagePrev").css("display", sender.get_currentPageIndex() === 0 ? "none" : "");
        $telerik.$(".pageNext").css("display", sender.get_currentPageIndex() === sender.get_pageCount() - 1 ? "none" : "");
    }
</script>

CSS:
#listView
{
    width: 780px;
    height: 270px;
    margin: 20px auto;
    position: relative;
}
 
.pagePrev, .pageNext
{
    width: 22px;
    height: 22px;
    position: absolute;
    top: 132px;
    background: transparent url('Common/sprite.gif') no-repeat scroll 0 0;
}
 
.pagePrev
{
    left: -40px;
}
 
.pagePrev
{
    background-position: 0 -700px;
}
 
.pagePrev:hover
{
    background-position: 0 -750px;
}
 
.pageNext
{
    right: -15px;
}
 
.pageNext
{
    background-position: 0 -850px;
}
 
.pageNext:hover
{
    background-position: 0 -900px;
}
 
.item
{
    float: left;
    background-color: #333333;
    color: #ffffff;
    cursor: pointer;
    font-size:12px;
    height: 76px;
    padding-top: 10px;
    width: 240px;
    margin: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-box-shadow: 1px 1px 3px #212121;
    -webkit-box-shadow: 1px 1px 3px #212121;
    box-shadow: 1px 1px 3px #212121;
    position: relative;
}
 
.item:hover
{
    color: black;
    background-color: #9EC101;
    background-image: -moz-linear-gradient(#577D00, #89AC05);
    background-image: -webkit-linear-gradient(#577D00, #89AC05);
    background-image: -o-linear-gradient(#577D00, #89AC05);
    background-image: linear-gradient(#577D00, #89AC05);
}
.item img, .item .photo
{
    width: 57px;
    height: 70px;
    float: left;
    border: 1px solid #0E0E0E;
    margin: -3px 10px 0 7px;
    background-color: #111111;
}
 
.item .name, .item .company
{
    display: block;
    margin-bottom: 4px;
    line-height: 14px;
}
 
.item .company
{
    line-height: 12px;
    text-transform: uppercase;
}
 
.item .title
{
    position: absolute;
    right: 10px;
    bottom: 5px;
    font-size: 12px;
}
 
.empty
{
    padding: 10px;
    text-align: center;
    color: White;
    background-color: #333333;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-box-shadow: 1px 1px 3px #212121;
    -webkit-box-shadow: 1px 1px 3px #212121;
    box-shadow: 1px 1px 3px #212121;
}

Antonio Stoilkov
Telerik team
 answered on 24 May 2012
1 answer
82 views
Hello everyone I hope you are very well

I hope you can help me;

Is there a sequence of steps you must take to update my Telerik controls (Q1 2011) to (Q2 2012)?

I worry that all my practices were going to damage

Thanks in advance
Happy Coding

M.
Martin
Telerik team
 answered on 24 May 2012
1 answer
71 views
Hello,

I am not able to find RadBarCode control in telerik dll.(version 2012.1.301.40).

Thanks,
Jayesh Goyani
Martin
Telerik team
 answered on 24 May 2012
1 answer
178 views
Can someone tell me why this code doesn't work? Checked the demos and documentation but didn't find an answer and the forum related to this topic are very old.

<telerik:RadRotator ID="rotator1" runat="server" Width="800px" Height="150px" SlideShowAnimation-Type="Fade" SlideShowAnimation-Duration="500" ItemHeight="63" ItemWidth="125" RotatorType="Buttons" OnClientItemShown="OnClientItemShown"></telerik:RadRotator>
var item = new Telerik.Web.UI.RadRotatorItem();
item.Controls.Add(new LiteralControl("<div>1</div>"));
rotator1.Items.Add(item);
Princy
Top achievements
Rank 2
 answered on 24 May 2012
1 answer
410 views

How I can get "Name" Column value on DeleteCommand,

aspx:
<telerik:RadGrid ID="SecurityGrid" runat="server" OnNeedDataSource="SecurityGrid_NeedDataSource"
            OnItemCommand="SecurityGrid_ItemCommand" OnPreRender="SecurityGrid_PreRender"
            OnDeleteCommand="UserGrid_DeleteCommand" OnUpdateCommand="SecurityGrid_UpdateCommand"
            OnInsertCommand="SecurityGrid_InsertCommand" AutoGenerateColumns="False" OnItemCreated="SecurityGrid_ItemCreated">
            <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top" EditMode="InPlace" TableLayout="Auto"
                Width="100%">
                <Columns>
                    <telerik:GridEditCommandColumn HeaderStyle-Width="2%" UniqueName="EditCommandColumn"
                        ButtonType="ImageButton" EditImageUrl="../Images/grid_edit.png">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn UniqueName="btnDelete" ConfirmDialogType="RadWindow" ButtonType="ImageButton"
                        CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px" HeaderStyle-Width="2%" />
                    <telerik:GridTemplateColumn DataField="Id" UniqueName="Id" Visible="false">
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("Id") %>' ReadOnly="true"
                                Enabled="false" />
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Eval("Id") %>' ReadOnly="true" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="Name" DataField="Name">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtName" Width="120px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RFName" runat="server" ErrorMessage="*" CssClass="validator"
                                ControlToValidate="txtName"></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="cvName" CssClass="validator" OnServerValidate="cvName_ServerValidate"
                                Display="Dynamic" runat="server" ControlToValidate="txtName"></asp:CustomValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="Level" DataField="Level">
                        <EditItemTemplate>
                            <telerik:RadNumericTextBox ID="txtLevel" Width="50px" runat="server" DbValue='<%# DataBinder.Eval(Container.DataItem, "Level") %>'>
                                <NumberFormat DecimalDigits="0" />
                            </telerik:RadNumericTextBox>
                            <asp:RequiredFieldValidator ID="RFLevel" runat="server" ErrorMessage="*" CssClass="validator"
                                ControlToValidate="txtLevel"></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="cvLevel" CssClass="validator" OnServerValidate="cvLevel_ServerValidate"
                                Display="Dynamic" runat="server" ControlToValidate="txtLevel"></asp:CustomValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblLevel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Level") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <CommandItemTemplate>
                    <div style="width: 100%">
                        <div style="width: 10%; margin-left: 12px; float: left">
                            <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert">
                                <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/UI/Images/add.png" />
                                <asp:Label ID="lblQuickAdd" runat="server" /></asp:LinkButton>&nbsp;&nbsp;
                        </div>
                    </div>
                </CommandItemTemplate>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnColumnHidden="onColumnHidden" OnRowDblClick="RowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>


.cs


  protected void UserGrid_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            string securityLevelId = ((GridDataItem) e.Item).GetDataKeyValue("Id").ToString();
            Session["ID"] = securityLevelId;

            bool hasUser = Master.Organization.SecurityLevelHasUser(Convert.ToInt16(securityLevelId));
            bool hasDocument = Master.Organization.SecurityLevelHasDocument(Convert.ToInt16(securityLevelId));

            LogConfig.SaveInFile(Level.Debug, "Show Deleted popup", null, typeof (SecurityLevel).FullName,
                                 Master.StackTrace.GetFrame(1).GetMethod().Name);


            GridDataItem dataItem = e.Item as GridDataItem;
            string contactName = dataItem["Name"].Text;-->
THIS IS NULL
          

        
        }
Shinu
Top achievements
Rank 2
 answered on 24 May 2012
1 answer
100 views
I have inserted an image to telerik editor. And by default, it is setting width and height of image , it is setting those values as attribute not as style="width:__px;height:__px".  And while inserting any image with width and height set it inserts image properly ,, but image tag is created like this.

<img src="proper_path_to_image" style="width: NewWidth px; height: NewHeight px; " width="OldWidth" height="OldHeight" align="">

Here is the screencast link : http://screencast.com/t/HARGXm2GtrW3 
Arindam
Top achievements
Rank 1
 answered on 24 May 2012
1 answer
287 views
Hello,

I am using ClientSide setting to access the value of the RadNumeric Textbox.

If the value is incorrect(according to the business rules), I want to clear the value in Textbox and focus on the textbox.

The value is not getting cleared for me. How to do this ?

Here is my Code

 function ValueChanged(sender, args) {

alert("Incorrect Value");
sender.focus();
//Clear the Textbox Value.
}
Shinu
Top achievements
Rank 2
 answered on 24 May 2012
1 answer
236 views
Hello,

I dont want user to enter more than 2 digits after decimal.

How can I do this in Rad NUmeric textbox ?

TIA
Shinu
Top achievements
Rank 2
 answered on 24 May 2012
4 answers
198 views
Hi, is it posible to change the dotted line on the org chart, with the solid line and has arrow on the end of the line,
also, for the export to PDF feature, i search on the other thread, it said that it can be achived using PDFForge, how is the approach ?

i checked on the PDFForge website, it is only provide an exe file.


Thanks,
Ricky
Ricky
Top achievements
Rank 1
 answered on 24 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?