Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
618 views
I'm going to try and make this as short as possible another developer created some controls, I am attempting to use a checkboxlist that when an item is selected to have the data entered in a Listbox.  With using a postback the page refreshes every time I select an item, so I started searching on how to postback without refreshing the page. The closest that I have gotten is with the attached code; the issue with the current code is the information is entered into the box but it is as though some event is waiting to happen after I select an item because I am getting the spinning symbol when I move around various spots on the page and it prevents me from clicking on a seperate button while this is occurring.  If anyone can provide any assistance please help.  I have attempted to use the below forums as reference.

http://www.telerik.com/community/forums/community-forums/web-2/radgrid-refresh-without-postback.aspx

http://www.telerik.com/community/forums/aspnet-ajax/window/radwindow-and-radajaxpanel.aspx
 
in ascx
<telerik:RadComboBox ID="rcb_County" runat="server" OnDataBound="rcb_County_DataBound">
                                <ItemTemplate>
                                    <asp:CheckBoxList ID="cbl_County" runat="server" autopostback="True" OnSelectedIndexChanged="CheckBoxList_SelectedIndexChanged">
                                    </asp:CheckBoxList>
                                </ItemTemplate>
                            </telerik:RadComboBox>
                            <asp:CustomValidator ID="cvCounty" runat="server" ClientValidationFunction="validateCounty"
                                CssClass="validation" ErrorMessage="* Required"></asp:CustomValidator>
in ascx
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <ClientEvents></ClientEvents>
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rcb_County">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rcb_County" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
Code Behind
protected void CheckBoxList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox.Items.Clear();
            System.Threading.Thread.Sleep(1000);
            CheckBoxList cbl_County = rcb_County.Items[0].FindControl("cbl_County") as CheckBoxList;
            foreach (ListItem val in cbl_County.Items)
            {
                if (val.Selected)
                {
                    ListBox.Items.Add(val.Text);
                }
            }
        }
Nencho
Telerik team
 answered on 13 Dec 2013
15 answers
304 views
We are using the RadGrid control to retrieve User objects from a repository that uses NHibernate to retrieve the objects. I am using an object data source defined as:
<asp:ObjectDataSource ID="UsersData" runat="server" SelectMethod="GetAll" DataObjectTypeName="TestingApp.Lib.Domain.User" TypeName="TestingApp.Lib.Repositories.UserRepository">
</asp:ObjectDataSource>

The method signature for GetAll is as follows:
public IEnumerable<User> GetAll();

With NHibernate, some Users are actually AdminUsers which extends User. It seems the repository is currently returning an AdminUser object first, and the control seems to be assuming then that the rest of the objects will be AdminUser rather than User. This causes the following exception to be thrown:
"Unable to cast object of type 'TestingApp.Lib.Domain.User' to type 'TestingApp.Lib.Domain.AdminUser'."

Is there a way to force the control to assume that data bound objects are User rather than AdminUser? Thanks!
Andy
Top achievements
Rank 1
Iron
 answered on 13 Dec 2013
1 answer
117 views
Working Code: I have a Grid, and it has list of filename's with radio button. If I select a radio button, I can display image for the filename in the RadImageEditor. If I change the radio button or click another row, the image is updated properly. When image is displayed and If I click on zoom in zoom out, and then reset, the image is displayed in its original form the way it was loaded.
1) The problem comes when I first rotate an image, then click on reset changes , the image does not come to its original form the way it was initially loaded.
2) Continuing the step 1, if I now try to change radiobutton so try to load another image, an error is thrown.

Let me know any better way or possible solution to this issue. The demo does not give proper information for this issue, so putting in this forum.
 Markup Code:
<%@ Page Title="Home Page" Language="vb"   AutoEventWireup="false"   CodeBehind="Default.aspx.vb" Inherits="DocumentMgr._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"  >
    <title></title>
   
     <script type="text/javascript">
         function OnClientCommandExecuting(sender, eventArgs) {

             if (eventArgs.get_commandName() == "Reset") {                 
                 var imgEditor = $find("<%=rie.ClientID %>");
                 imgEditor.getEditableImage()._finishReset();
                 eventArgs.set_cancel(true);
             }
             return false;
         }
         
    </script>
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
   <%--<asp:FileUpload ID="fup" runat="server" />
    <asp:Button ID="submit" runat="server"  Text="Submit" OnClick="Submit_Click" />--%>
     <asp:ScriptManager ID="sm" runat="server"  ></asp:ScriptManager>
    <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <telerik:radgrid id="grTL" skin="Office2010Silver" allowfilteringbycolumn="false"  
        width="100%" height="150px" showstatusbar="true" runat="server" allowpaging="True"
        allowsorting="True" enableajax="True" allowcustompaging="false" pagesize="23"
        editformitem="false" autogeneratecolumns="false" enablecolumnsviewstate="false"
        autogenerateeditcolumn="false" enableariasupport="true" MasterTableView-DataKeyNames="ID"
        >
       
        <MasterTableView HeaderStyle-Font-Bold="true" ShowFooter="False" AllowNaturalSort="false"
                                    EditMode="InPlace" CommandItemDisplay="None" Summary ="">
            <Columns>
                <telerik:GridTemplateColumn UniqueName="Select" HeaderText="" HeaderStyle-Width="40"
                    HeaderStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:RadioButton ID="rbSelect" AutoPostBack="true" EnableTheming="true" Font-Bold="true"
                            runat="server" OnCheckedChanged="rbSelect_CheckedChanged" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                
                 <telerik:GridTemplateColumn HeaderText="FileName" >
                    <ItemTemplate>
                        <asp:Label ID="lblFileName" runat="server" Width="200px" Text='<%# Eval("FileName") %>'></asp:Label>                        
                    </ItemTemplate>
                    <EditItemTemplate>
                         <asp:Label ID="lblEFileName" runat="server" Width="200px" Text='<%# Eval("FileName") %>'></asp:Label>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Information" >
                    <ItemTemplate>
                        <asp:Label ID="lblInfo" runat="server" Width="200px" Text='<%# Eval("Information") %>'>
                        </asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox ID="txtEditInfo" runat="server"  Width="200px" Text='<%# Bind("Information") %>' TabIndex="1" />                                                
                    </EditItemTemplate>
                   
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings AllowColumnsReorder="true">
            <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="3" />
            <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                ClipCellContentOnResize="true" EnableRealTimeResize="false" />
        </ClientSettings>
    </telerik:radgrid>
 

<telerik:RadImageEditor ID="rie" runat="server" EnableResize="true"    
  Width="100%" Height="500px" EnableEmbeddedScripts="true"   OnClientCommandExecuting="OnClientCommandExecuting"   
ToolsFile="Basic.xml"  >
 
</telerik:RadImageEditor>
    </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

Code Behind:
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            BindData()
        End If
    End Sub

    Private Sub BindData()
        grTL.DataSource = GetListOfImages()
        grTL.DataBind()
    End Sub
    Private Function GetListOfImages() As List(Of FileData)
        Dim images = New List(Of String)()
        Dim arr As List(Of FileData) = New List(Of FileData)
        Dim files As Files = New Files
        Try
            arr = files.GetFileWoAttachment()
            ' Get a list of FileName with extension to be displayed in Grid.
            
            
        Catch ex As Exception
            'log exception

        End Try

        Return arr

    End Function
    Protected Sub rbSelect_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)


        Dim bCAllToday As Boolean = False
        'Session("RowIndex") = 0

        Dim item As GridDataItem = DirectCast(TryCast(sender, RadioButton).NamingContainer, GridDataItem)
        Dim rdBtn As RadioButton = TryCast(sender, RadioButton)

        If rdBtn.Checked Then
            Session("RowIndex") = item.ItemIndex
            item.Selected = True
            rie.ImageUrl = "ShowImg.ashx?ID=" + CType(grTL.SelectedValues("ID"), String)
            Session("RowIndex") = CType(grTL.SelectedValues("ID"), String)
            rie.DataBind()

          
        End If

    End Sub

HANDLER:

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim my_Id As Int32
        If context.Request.QueryString("ID") IsNot Nothing Then
            my_Id = Convert.ToInt32(context.Request.QueryString("ID"))
            context.Response.ContentType = "image/png"
            context.Response.Buffer = True
            Dim strm As Stream = ShowEmpImage(my_Id)
            Dim bmp As Bitmap = New Bitmap(strm)
            bmp.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png)
          
        End If
        
    End Sub

    Public Function ShowEmpImage(ByVal my_Id As Integer) As Stream
        Dim fs As Files = New Files()
        Dim fdata As FileData = fs.GetFile(my_Id)
        'Attachment property defined in Class  As Byte()
        If (fdata.Attachment IsNot Nothing) Then
            Return New MemoryStream(DirectCast(fdata.Attachment, Byte()))
        Else
            Return Nothing
        End If

    End Function

Vessy
Telerik team
 answered on 13 Dec 2013
2 answers
229 views
I'm trying to Clear a RadComboBox in javascript, and have it post back (when AutoPostBack is enabled). I've been searching around for a solution, and this is the best I can come up with - but it feels incredibly hacky - is there a more appropriate method of doing this?

var combo = $find(comboId);
combo.hideDropDown();
combo.trackChanges();
combo.clearSelection();
combo.commitChanges();
var f = { Command: "Select", Index: combo.get_selectedIndex() };
combo.postback(f);

Thanks
Fergal
Fergal
Top achievements
Rank 1
 answered on 13 Dec 2013
1 answer
310 views
Hi Telerik developers;

This problem RadGrid in radwindow open in server side GridClientSelectColumn selected

Gird in Columns
<Columns>
                       <telerik:GridClientSelectColumn UniqueName="chkSelectColumn" HeaderStyle-Width="20px"></telerik:GridClientSelectColumn>
                       <telerik:GridBoundColumn DataField="CekKartID" HeaderText="ID" ReadOnly="true" ShowFilterIcon="false" Display="false" UniqueName="CekKartID"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="CekNo" HeaderText="Çek No" FilterControlWidth="80%" ShowFilterIcon="false" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="BankaAdi" HeaderText="Banka Adi" FilterControlWidth="80%" ShowFilterIcon="false" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="AlinanCari" HeaderText="Alinan Cari Unvan" FilterControlWidth="80%" ShowFilterIcon="false" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="VadeTarihi" HeaderText="Vade Tarihi" FilterControlWidth="80%" ShowFilterIcon="false" HeaderStyle-Width="100px"></telerik:GridBoundColumn>
                       <telerik:GridNumericColumn DataField="Tutar" HeaderText="Tutar" DataFormatString="{0:N}" Aggregate="Sum" FilterControlWidth="20%" ShowFilterIcon="false" HeaderStyle-Width="100px" />
                   </Columns>


C# is Radgrid item data bound
protected void grdPortCekIade_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
 
               GridDataItem dataBoundItem = e.Item as GridDataItem;
 
               var rowID= dataBoundItem["CekKartID"].Text;
                
                //sesCekKart = session in CekKart Table
               if (Convert.ToInt32(rowID) == sesCekKart.CekKartID)
               {
                   CheckBox chk = (CheckBox)dataBoundItem["chkSelectColumn"].Controls[0];                   
                   chk.Checked = true;
               }
           }
 
 
       }

RadWindow open and grid columns no selected GridClientSelectColumn
I want you selected the selected object
This radwindow image in click


Konstantin Dikov
Telerik team
 answered on 13 Dec 2013
1 answer
52 views
I have a RadGrid that displays the results of a query submitted by the user. If the user requeries I want the vertical scroll position to be at the top of the grid, not at the position of the previous query. How do I do this?

I have tried the following in the PreRender event all to no avail:

           RadGrid1.MasterTableView.CurrentPageIndex = 0;

and this..

          if (RadGrid1.MasterTableView.Items.Count > 0)
            {
                RadGrid1.MasterTableView.Items[0].Selected = true;
            }

Here are my property settings

        <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" Width="100%"  
            Height="450px" ShowStatusBar="True"
            AutoGenerateColumns="False" CellSpacing="0" GridLines="None" 
            onprerender="RadGrid1_PreRender" 
            onitemdatabound="RadGrid1_ItemDataBound" 
            ondetailtabledatabind="RadGrid1_DetailTableDataBind" 
            onneeddatasource="RadGrid1_NeedDataSource" 
                OnItemCreated="RadGrid1_ItemCreated" 
                onsortcommand="RadGrid1_SortCommand">
                  <MasterTableView DataKeyNames="GloveId, MaterialType, Chemical" HierarchyDefaultExpanded="true" Name="PermDataGroup" CssClass="masterTablePadding" 
                GroupsDefaultExpanded="False" >


Thanks,
Rob
Eyup
Telerik team
 answered on 13 Dec 2013
17 answers
557 views
 i have create tab and alone with it's pageview .it's work fine for deleting i add close image button to another class .(i.e. add tab and pageview in one class and deleting tab in another class) tab is deleting but pageview of that tab is not delete.how can i delete tab alone with pageview.pls help me
Nencho
Telerik team
 answered on 13 Dec 2013
1 answer
225 views
Hi - After upgrading from Q3 2013 to Q3 2013 SP1 I get borders around my check boxes in IE 8.  Chrome and firefox do not have them. 
You can see this here in your demo
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

Is this change expected behavior for IE 8? or is this a bug?

Thanks
Eyup
Telerik team
 answered on 13 Dec 2013
1 answer
838 views
Hey

I'm trying to figure out how to edit the default css in the webresource.axd file, as its failing compatibility and accessibility tests. 

For example..

*html .RadTreeView .rtMinus{margin-right:1px}

Anyone know where I can find that file and edit it?

Thanks

John
Ivan Zhekov
Telerik team
 answered on 13 Dec 2013
15 answers
301 views
Hello,
    In the web application we are developing using the latest version of RadControls for Ajax, we make use of RadSplitter and RadTabStrip. We would like to format the selected tab's  text as bold so we have tried several approaches to accomplish it, one of them using the tab's SelectedCssClass:
tab.SelectedCssClass  = "highlightedTab";
  
  
where
  
  
  .highlightedTab
  {
         font-weight: bold !important;
  }
The other approach we have tried is to directly modify the CSS class of the selected tab:
.RadTabStripTop_Office2007 .rtsSelected
 {
        font-weight: bold !important;
 }

Both of these approaches produce the expected result but are also causing a problem: the last tab in the tabstrip ocassionally disappears. We have looked into the issue using Firebug and we noticed that the inner list of the tabstrip does not update its width when a tab caption is made bold (therefore the tab width increases) and it causes the last tab to be wrapped on the following row because there is not enough room left for it.
We have tried updating the list's width through client side code every time a tab is selected, but we couldn't get the tabstrip to work properly given that it also has the scroll buttons enabled.
Please advise us on how to fix this issue.
Thank you.
Ivan Zhekov
Telerik team
 answered on 13 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?