Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
171 views
I can insert everythings here using Chrome Developer Tool.
Slav
Telerik team
 answered on 06 Dec 2013
1 answer
706 views
Hi Team,

I want to hide HTML option in the Tool bar of Radeditor. I saw your post -
http://www.telerik.com/community/forums/aspnet-ajax/editor/hiding-text-from-the-design-html-amp-preview-buttons-in-radeditor.aspx. This works smoothly.

Besides style, do you have any other way to avoid HTML option rendering on the page?

Thanks,
PK

Marin Bratanov
Telerik team
 answered on 06 Dec 2013
1 answer
100 views
I have a Telerik Ajax Panel with a dropdownlist, a textbox (both with autopostback = true) and then another two readonly textboxes inside it. All controls are telerik controls.

The editable textbox has a serverside event TextChanged. When a user enters text and then hits return the ajaxloadingpanel is triggered (I get the spinning graphic) and once the server side code has completed the readonly textboxes are populated. When a user enters text and then hits TAB the ajaxloadingpanel is not triggered (no graphic) but eventually the readonly textboxes are populated.

How can I get the ajaxloadingpanel to trigger in both situations ie when the RETURN key or the TAB key are used.
Mych
Top achievements
Rank 1
 answered on 06 Dec 2013
1 answer
338 views
Hi there,  I tried using the following example to create a simple grid with auto CRUD.  It looks good but when I click the "update" button the edited fields just reset and nothing else happens.

http://www.telerik.com/community/code-library/aspnet-ajax/grid/automatic-operations-with-sqldatasource-control.aspx

I've had to programmatically add the datasource as my app is rocking a legacy connection string encription routine.

Here's my ASP page:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Edit_GovernanceContacts.aspx.vb"
    Inherits="APSubmission.Edit_GovernanceContacts" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="Menu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Submission System</title>
</head>
<body style="background-color: #f2ffff">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <uc1:Menu ID="Menu1" runat="server"></uc1:Menu>
    </div>
    <div style="padding: 10px 0 0 10px">
        Edit Governance Contacts
        <telerik:RadGrid ID="gridContacts" runat="server" AllowAutomaticDeletes="True" EnableAJAX="True"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Skin="WebBlue">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="recID" CommandItemDisplay="TopAndBottom">
                <EditFormSettings>
                    <EditColumn UniqueName="EditCommandColumn"></EditColumn>
                </EditFormSettings>
                <Columns>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="imagebutton" />
                    <telerik:GridBoundColumn DataField="recID"
                        FilterControlAltText="Filter columnID column" HeaderText="ID"
                        UniqueName="recID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="submissionSetID"
                        FilterControlAltText="Filter columnSubmissionSet column"
                        HeaderText="Submission Set ID" UniqueName="submissionSetID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="contactName"
                        FilterControlAltText="Filter columnContactName column"
                        HeaderText="Contact Name" UniqueName="contactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="addDate" DataType="System.DateTime"
                        FilterControlAltText="Filter columnAddDate column" HeaderText="Add Date"
                        ReadOnly="True" UniqueName="addDate">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="addWho"
                        FilterControlAltText="Filter columnAddWho column" HeaderText="Add Who"
                        ReadOnly="True" UniqueName="addWho">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn UniqueName="ButtonColumn" Text="Delete" CommandName="Delete"
                        ButtonType="LinkButton"/>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>


And the code behind to create the datasource:
Protected Sub gridContacts_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles gridContacts.NeedDataSource       
        Dim myDataSource As New SqlDataSource
 
        myDataSource.ConnectionString = _functions.GetConnectionString()
        myDataSource.DeleteCommand = "delete GovernanceContact where recID = @recID"
        myDataSource.InsertCommand = "insert GovernanceContact (submissionSetID, contactName, addDate, addWho) values @submissionSetID, @contactName, @addDate, @addWho)"
        myDataSource.SelectCommand = "select * from GovernanceContact where submissionSetID = @submissionSetID"
        myDataSource.UpdateCommand = "update GovernanceContact set contactName = @contactName where recID = @recID"
 
        myDataSource.DeleteParameters.Add("recID", DbType.Int32)
 
        myDataSource.InsertParameters.Add("submissionSetID", DbType.Int32, _editSubmissionSetID)
        myDataSource.InsertParameters.Add("contactName", DbType.String)
        myDataSource.InsertParameters.Add("addDate", DbType.DateTime)
        myDataSource.InsertParameters.Add("addWho", DbType.String)
 
        myDataSource.SelectParameters.Add("submissionSetID", DbType.Int32, _editSubmissionSetID)
 
        myDataSource.UpdateParameters.Add("contactName", DbType.String)
        myDataSource.UpdateParameters.Add("recID", DbType.Int32)
 
        gridContacts.DataSource = myDataSource
        gridContacts.MasterTableView.DataSource = myDataSource
    End Sub

I'm obviously doing something wrong, but I just don't know what it is.

Thanks for any help you can provide,
Kenyon.
Viktor Tachev
Telerik team
 answered on 06 Dec 2013
1 answer
152 views

Hi,

I have an implementation question which I'm hoping someone with much more experience and expertise could guide me in the right direction.

I need to load a batch of 5000 ~ 10,000 phone numbers into a database.

The user can select and upload a file using RadUpload and RadGrid with Paging turned on.

The user can preview, add, delete the record in the RadGrid and then click on 'Insert' button to load the phone numbers into database.

I'm really hoping to cache the data instead of using a saved file on the server for re-binding.

I think RadGrid only holds data for the current page, so what would be the best way to implement this?

Thank you in advance~

Helen


This is what I'm currently doing in code behind...newbie style!

protected void Page_Load(object sender, EventArgs e)
{
    this.tollFreeInventoryLogic = (TollFreeInventoryLogic)this.Session[SESSION_ATTR_NAME];
    if (tollFreeInventoryLogic == null)
    {
        this.tollFreeInventoryLogic = new TollFreeInventoryLogic();
        this.Session[SESSION_ATTR_NAME] = this.tollFreeInventoryLogic;
    }
}
protected void RadButtonUploadToGrid_Click(object sender, EventArgs e)
{
    string targetFolder = RadUpload1.AppRelativeTemplateSourceDirectory + RadUpload1.TargetFolder;
    string fileName = targetFolder + "/" + RadUpload1.UploadedFiles[0].GetName();
    Session["fileName"] = fileName;
 
    GetDataFromMemory();
}
 
protected void GetDataFromFile()
{
    if (Session["fileName"] != null)
    {
        string fileName = (string)Session["fileName"];
        try
        {
            using (StreamReader sr = new StreamReader(Server.MapPath(fileName)))
            {
 
                string tollFreeList = sr.ReadToEnd();
                string[] tollFreeArray = tollFreeList.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None);
 
                DataTable dt = CreateDataTable(tollFreeArray);
                RadGrid1.DataSource = dt;
            }
             
        }
        catch (Exception err)
        {
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(err.Message);
        }
    }
}
 
protected void GetDataFromMemory()
{
    foreach (UploadedFile file in RadUpload1.UploadedFiles)
    {
 
        byte[] bytes = new byte[file.ContentLength];
        file.InputStream.Read(bytes, 0, bytes.Length);
        string tollFreeList = System.Text.Encoding.Default.GetString(bytes);
        string[] tollFreeArray = tollFreeList.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None);
 
        DataTable dt = CreateDataTable(tollFreeArray);
 
        RadGrid1.DataSource = dt;
        RadGrid1.DataBind();
 
    }
     
}
 
private DataTable CreateDataTable(string[] tollFreeArray)
{
    DataTable dt = new DataTable();
    DataRow dr;
    dt.Columns.Add("TollFreeNumber");
    foreach (string line in tollFreeArray)
    {
        //Debug.WriteLine(line);
        if (line.Trim().Length > 0)
        {
            dr = dt.NewRow();
            dr["TollFreeNumber"] = line;
            dt.Rows.Add(dr);
        }
    }
    return dt;
}
 
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    GetDataFromFile();
}
Viktor Tachev
Telerik team
 answered on 06 Dec 2013
1 answer
114 views
Is it possible to format the RadGrid results a certain way automatically?  It appears that the filtering items automatically choose which items are available based on the text in the column.  ie. If it is text, it adds the option "starts with" but if it is a number than it has other options so

What I would like is if it is determined to be a # account that it will properly format the results with commas. 

I had found where if I put it in the RadGrid_ColumnCreated, that I could do it there but I would have over 200 columns to possibly check.

Kurt Kluth
Top achievements
Rank 1
 answered on 06 Dec 2013
0 answers
119 views
Hi supporters,

I developed report by using reportviewer control in a portal.

Unfortunately, the reportviewer doesn't show correctly as described, it lost all icons in lost its functions also.

I attached herein the captured image of the control and the error which is shown when I inspecting the element in chrome browser.

Please help.
Tran
Top achievements
Rank 1
 asked on 06 Dec 2013
1 answer
192 views
function openRadWindow(url, title, width, height) {
    var oManager = GetRadWindowManager();
    oWnd = oManager.open(url, null);
    oWnd.set_title(title);
    oWnd.setSize(width, height);
    oWnd.center();
}

The function GetRadWindowManager returns NULL in IE 11 (and probably 10). Both, Chrome and Firefox working fine. The Function is executed manually by clicking a button, so I'm sure the page is completely loaded.

I'm working with Telerik 2013.2 SP1. Is this fixed in current releases?
Marin Bratanov
Telerik team
 answered on 06 Dec 2013
1 answer
167 views

Hi,
I am having grid autorefresh issue. I am using telerik grid and i use a timer to auto refresh [using Ajax - Ajaxify Timer]. If we open a child window [radWindow] from parent-  On Auto refresh of parent, Child Window gets closed. Can somebody help me to do the auto refresh of parent grid without closing child window.


Thanks!
Tarun
Viktor Tachev
Telerik team
 answered on 06 Dec 2013
1 answer
219 views
Playing a bit with the control I found some issues:
- If you use DataTitleField and DataDescriptionField and those are null in the DB (I may have some pictures with descriptions and other with just the title or maybe even some picture without both), you receive a system.nullreference exception instead of a pic with empty title/description

- If the pic is small ore the title/description is long, the image count text goes out the borders of the lightbox instead of expanding it. Screenshot here

 - When paging images inside an open LightBox with the supplied arrows, in a databound set, i receive a JS error: 
Uncaught TypeError: Cannot call method 'get_imageUrl' of undefined RadLightBoxScripts.js:270
c.RadLightBox._determineContentMode RadLightBoxScripts.js:270
c.RadLightBox._showLightBoxStructure RadLightBoxScripts.js:138
(anonymous function) RadLightBoxScripts.js:291
b.isFunction.i jQuery.js:3
r.complete jQuery.js:5
c jQuery.js:3
p.fireWith jQuery.js:3
u jQuery.js:5
b.fx.tick

- [SOLVED] Adding a RadLightBoxItem in code behind with a target control before bounding to a collection (code follows), works BUT when opening the lightbox while the total number of pics displayed in the box is correct (sums the manually inserted items + the databound item) the number of the actual opened pic is wrong it always gets 1 both if you open the manually added item and the first data bound item, something like 1 of 5 for both.
Dim lightBoxItem As New RadLightBoxItem
lightBoxItem.TargetControlID = "MainImage"
lightBoxItem.ImageUrl = LinkHelpers.GetProfilePath(profile.ProfileId) & profile.ImagePath
 
Dim profileImagesLightBox As RadLightBox = DirectCast(EvaForm.FindControl("ProfileImagesLightbox"), RadLightBox)
profileImagesLightBox.Items.Add(lightBoxItem)

in aspx (that's inside a formview inside a user control nested in a radgrid..)
<fieldset>
    <legend>5. Foto</legend>
    <dl class="dl-horizontal">
        <dt><%#: If(Not String.IsNullOrWhiteSpace(Item.ImageDescription), Item.ImageDescription, "Foto")  %></dt>
        <dd>
            <div class="profile-photo">
                <asp:PlaceHolder runat="server" Visible='<%# Not (String.IsNullOrWhiteSpace(Item.ImagePath)) %>'>
                    <asp:image runat="server" ID="MainImage" ImageUrl='<%# LinkHelpers.GetProfilePath(Item.ProfileId) & "t2-" & Item.ImagePath %>' CssClass="img-polaroid" />
                </asp:PlaceHolder>
            </div>
        </dd>
    </dl>
    <dl class="dl-horizontal">
        <dt>Altre foto</dt>
        <dd>
            <telerik:RadLightBox ID="ProfileImagesLightbox" runat="server" DataImageUrlField="ImagePath" Modal="true" AppendDataBoundItems="true" TabIndex="101">
                <ClientSettings AllowKeyboardNavigation="true" NavigationMode="Zone">
                    <AnimationSettings HideAnimation="None" NextAnimation="Resize" PrevAnimation="Resize" ShowAnimation="Resize" />
                </ClientSettings>
            </telerik:RadLightBox>
 
            <asp:Repeater runat="server" ID="ProfileImages" ItemType="Eva.Entities.EvaProfileImage">
                <ItemTemplate>
                    <a href="<%# LinkHelpers.GetProfilePath(Item.ProfileId) & Item.ImagePath%>" onclick="return false;"><img style="display: inline;"  onclick="OpenRadLigthBox(<%# Container.ItemIndex %>, '<%= EvaForm.FindControl("ProfileImagesLightbox").ClientID %>');
                          
                         return false;" class="media-object img-polaroid" src='<%# LinkHelpers.GetProfilePath(Item.ProfileId) & "t1-" & Item.ImagePath%>' /></a>
                </ItemTemplate>
            </asp:Repeater>
        </dd>
    </dl>
</fieldset>

Here is the result: screenshot here with the bigger pic wich is inserted "manually" in code behind (since it comes from another db table) and the smaller pics are databound (always in code behind with custom data-binding)
[SOLVED]: This was solved with <%# Container.ItemIndex + 1 %> thus taking into account the item you added manually (1 in my case)

- Some attributes maybe are somehow "obscure" for newbies (I tryed to use them based on common sense) like PreserveCurrentItemTemplates or AppendDataBoundItems. Some examples in the docs would be much appreciated, as well as some example accessing the bound field values in the DataBound event to modify them (add paths, change descriptions/titles).
Milena
Telerik team
 answered on 06 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?