Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
380 views
I have RadGrid that uses NeedDataSource and it works fine. What I can't figure out in how to do an automatic insert, since the examples I could find do it in the DataSource definition in aspx code.

Can someone point me to an example  or a tutorial, please?
Shinu
Top achievements
Rank 2
 answered on 25 Oct 2011
1 answer
114 views
Hi there

Can anybody advise about a rather cosmetic problem I have with a radEditor that is set to be a particular height, but which makes a bit of a mess of the page the first time it is rendered. I currently have it hidden within a div, that I show last, in a bid to tidy up the display, but it doesn't seem to make much difference. What happens is that the radEditor seems to make a slight delay while it adjusts the height down to the height configured in the markup, but in the meantime the subsequent Javascript has been continuing, showing other nearby controls beneath the radEditor. They are in the correct place, but of course the radEditor is using the incorrect height for a second or so, during which the radEditor document and the other controls are scrambling about trying to occupy the same space in the window. 

This is what I have been experimenting with so far, but it doesn't seem to matter which order I set divs or other controls to show or hide, the radEditor resize always is the last thing to get completed:

Javascript segment:
------------------------ 

// I get a reference to the div containing the radEditor further up here, calling it 'editdiv'
// and a reference to the div underneath 'editdiv', containing the other controls, calling it 'maskdiv'

// Display the previously hidden radEditor
// Get reference to radEditor input document, and make sure it is hidden
var mycmnteditor = $find("ctl00_ContentPlaceHolder1_radCommentEditor2");
var oDocument = mycmnteditor.get_document();
oDocument.className = 'hide';

// Reveal the div that contains the radEditor
$(editdiv).removeClass().addClass("show");

// Control display of controls in the div underneath radEditor by showing their div
maskdiv.className = 'show';

// Finally, reveal the radEditor document, but even at this stage it is still the wrong height for a short time
oDocument.className = 'show'; 

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

All this Javascript works, it's just that there is the timing problem, with the radEditor height taking too long to be rendered. Is there any way to pause the rendering of other controls until the radEditor is at the right height, so that the page appearance loads more smoothly? I can't see any other client-side events in the documentation that would appear to be relevant, I already tried 'onclientload=', and it didn't seem to make any difference when I tried using it.

Thanks if you can help
 



Rumen
Telerik team
 answered on 25 Oct 2011
3 answers
254 views
Hi,

I have a telerik 35 version and a rad file explorer with following configurations in code behind:

oCmsBusiness =

 

new cmsBusiness();

 

fileExplorerFiles.Configuration.ContentProviderTypeName =

 

typeof(DBContentProvider).AssemblyQualifiedName;

 

olistCmsFolder = oCmsBusiness.ReadAllRootFolders();

 

 

var query = from entity in olistCmsFolder select entity.FolderName;

 

fileExplorerFiles.Configuration.ViewPaths = query.ToArray();

fileExplorerFiles.Configuration.UploadPaths = query.ToArray();

fileExplorerFiles.Configuration.DeletePaths = query.ToArray();

I am also set

 

fileExplorerFiles.EnableCreateNewFolder =

 

true;

 

My problem is during run time the Add folder icon is not showing in radfile tool bar and in context menu.In design time its showing.
Please help.

Regards,
Praveen.

Dobromir
Telerik team
 answered on 25 Oct 2011
1 answer
113 views
Hai,

I want to create a report in the following format. Here not all bars start from X axis. Bars B and C are not started from X axis. Is there any telerik chart which suits its requirements?

Thanks,
Regeesh Joseph

Evgenia
Telerik team
 answered on 25 Oct 2011
3 answers
235 views
how do i bind the dropdownlist in insert or edit mode and then how the Update or Insert command will find the control...
i tried a lot didnt worked

here is the code

protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
     {
         SqlDataAdapter da = new SqlDataAdapter("select c.City, s.State from MST_State as s inner join MST_City as c on c.StateID = s.ID ", con);
         DataTable mydatatable = new DataTable();
         da.Fill(mydatatable);
 
         RadGrid1.DataSource = mydatatable.DefaultView;
 
     }
     //protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
     //{
     //   
     //}
         protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
     {
        //GridEditableItem editedItem = e.Item as GridEditableItem;
        //UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
        GridEditFormInsertItem inserteditem = (GridEditFormInsertItem)e.Item;
        //Create new row in the DataSource
        
 
        //Insert new values
 
         string City = (inserteditem["City"].Controls[0] as TextBox).Text;
 
 
         DropDownList list = (inserteditem.FindControl("State") as DropDownList);
         string State = list.SelectedValue;
 
 
 
 
 
         con.Open();
         string insertquery = String.Format("insert into MST_City values('{0}',  '{1}')", City, State);
 
         SqlCommand sql = new SqlCommand();
         sql.CommandText = insertquery;
         sql.Connection = con;
         sql.ExecuteNonQuery();
         con.Close();
 
     }

and i want when i click add new record the state should be binded in dropdownlist...
Princy
Top achievements
Rank 2
 answered on 25 Oct 2011
1 answer
117 views
I'm trying to do something similar to the example here: http://www.telerik.com/help/aspnet-ajax/menu-with-radconfirm.html

It mostly works, however some menu items are navigate links to other pages in my application, and the NavigateUrl is something like "~/folder/page.aspx". Obviously this doesn't work. Is there any easy way (client-side) to get the value translated to an absolute URL, or do I have to change the code to put the absolute URL in the NavigateURL?

Thanks

ROSCO

Princy
Top achievements
Rank 2
 answered on 25 Oct 2011
4 answers
494 views
Hi All,

I'm evaluating 3rd party controls for my client's websites and wanted to find out if Telerik offers one particular functionality that is needed :-

We have a templated grid that contains various types of controls in different columns - say DatePicker, DropDownList, Numeric textbox etc. We want to be able to insert/update/delete rows in it entirely on the client side. When the user clicks "add new row", for example, a new row will be added with the DatePickers, DropDownList or whatever else is defined in the template. No changes are saved to the database at this point and once the user is done, he can click a "Save" button that will iterate the grid and save the changes.

So, basically the main problem is keeping the template of the grid while adding/editing rows from the client side (no ajax etc) and then be able to iterate it on server side. Can Telerik grid do this?

Thank You,
Manoj
Radoslav
Telerik team
 answered on 25 Oct 2011
1 answer
101 views
hello this is Vivek here
How can i generate Runtime control in edit or insert, like Binded Dropdown-list etc...

Regards Vivek
Shinu
Top achievements
Rank 2
 answered on 25 Oct 2011
1 answer
91 views
I am experiencing an issue which appears to be occurring in your demo of the Month/Year Picker control as well.  When we set ShowPopUpOnFocus="true", the user is unable to type a date into the DateInput field in FireFox and Safari.  This seems to work fine in IE.  Any suggestions?
Shinu
Top achievements
Rank 2
 answered on 25 Oct 2011
2 answers
168 views
I had this working yesterday.  I'm not sure what changed.  Clicking the edit button in one of my RadGrid rows throws out:

Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

from javascript.  Yesterday, it was bringing up the edit form just fine and letting me make changes.  It seems as if all my grid events fire on the client o.k. (Edit, ItemCommand, ItemDataBound, ItemCreated), then this error pops up.

Here's my markup if it helps.  I don't see what's going on.

(BTW, using the edit form to create an entity is working just fine.   It's only when I hit the edit link on an existing row).

Thanks,

Scott
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MediaList.ascx.cs" Inherits="PledgeWeb.MediaLibrary.Controls.MediaList" %>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        var mediaList = {};
 
        mediaList.get_AddDocumentModalUrl = function mediaList_getAddDocumentModalUrl() {
            return '<%= Page.ResolveClientUrl("~/MediaLibrary/Modals/AddDocument.aspx") %>';
        }
 
        mediaList.get_ViewDocumentModalUrl = function mediaList_getViewDocumentModalUrl(docId) {
            var url = '<%= Page.ResolveClientUrl("~/MediaLibrary/Modals/ViewDocument.aspx") %>' + '?id=' + docId;
            return url;
        }
 
        //On insert and update buttons click temporarily disables ajax to perform upload actions
        //for a more detailed description of why we need this.
        function conditionalPostback(sender, eventArgs) {
            var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
            if (eventArgs.get_eventTarget().match(theRegexp)) {
                var upload = $find(window['UploadId']);
 
                //AJAX is disabled only if file is selected for upload (i.e., new documents)
                if (upload != null && upload.getFileInputs()[0].value != "") {
                    eventArgs.set_enableAjax(false);
                }
            }
        }
 
        function validateRadUpload(source, e) {
            e.IsValid = false;
 
            var upload = $find(source.parentNode.getElementsByTagName('div')[0].id);
            var inputs = upload.getFileInputs();
            for (var i = 0; i < inputs.length; i++) {
                //check for empty string or invalid extension
                if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) {
                    e.IsValid = true;
                    break;
                }
            }
        }
 
    </script>
</telerik:RadCodeBlock>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        mediaList.onAddDocumentWindowClosed = function mediaList.onAddDocumentWindowClosed(sender, eventArgs) {
            var returnValue = eventArgs.get_argument();
 
            if (!Utils.WasRadWindowCancelled(returnValue, true)) {
                __doPostBack('', '');
            }
        }
 
        mediaList.openAddDocumentWindow = function mediaList_openAddDocumentWindow() {
            Utils.OpenRadWindow
                (
                    mediaList.get_AddDocumentModalUrl(),
                    600,
                    400,
                    mediaList.onAddDocumentWindowClosed
                );
        }
 
        mediaList.openViewWindow = function mediaList_openViewWindow(docId) {
            Utils.OpenRadWindow
                (
                    mediaList.get_ViewDocumentModalUrl(docId),
                    600,
                    400
                );
        }
    </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
    <asp:Panel ID="pnlMsg" runat="server">
        <asp:Label ID="lblMsg" runat="server" Style="color: Red; font-weight: bold;" />
    </asp:Panel>
 
    <telerik:RadGrid ID="grdMediaLibrary" runat="server" Skin="Default" AutoGenerateColumns="false"
        Width="100%" AllowPaging="true" PageSize="10" OnItemDataBound="grdMediaLibrary_ItemDataBound"
        AllowAutomaticInserts="false" AllowAutomaticUpdates="false" OnEditCommand="grdMediaLibrary_Edit"
        OnUpdateCommand="grdMediaLibrary_Update" OnInsertCommand="grdMediaLibrary_Insert"
        OnItemCommand="grdMediaLibrary_ItemCommand" OnItemCreated="grdMediaLibrary_ItemCreated"
        ShowStatusBar="true">
        <PagerStyle Mode="NumericPages" AlwaysVisible="false" Position="Bottom" CssClass="Pager" />
        <MasterTableView CommandItemDisplay="Top" ClientDataKeyNames="ID" DataKeyNames="ID">
            <NoRecordsTemplate>
                <asp:Label Text="No documents to display" runat="server" /></NoRecordsTemplate>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton">
                </telerik:GridEditCommandColumn>
                <telerik:GridTemplateColumn UniqueName="MenuColumn">
                    <ItemTemplate>
                        <telerik:RadMenu ID="itemMenu" runat="server" CausesValidation="false">
                            <Items>
                                <telerik:RadMenuItem Value="topMenuItem" ImageUrl="~/Images/collapsed_toggleExpandHover.gif"
                                    HoveredImageUrl="~/Images/collapsed_toggleExpandActive.gif" CssClass="SM_imageButton">
                                    <Items>
                                        <telerik:RadMenuItem Text="Archive" ImageUrl="~/Images/archive.jpg" />
                                        <telerik:RadMenuItem Text="Recover From Archive" ImageUrl="~/Images/undo.png" />
                                    </Items>
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadMenu>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="ID" Visible="false" ReadOnly="true" UniqueName="DocID" />
                <telerik:GridTemplateColumn HeaderText="Document Name" UniqueName="DocName" ReadOnly="false">
                    <ItemTemplate>
                        <asp:Label ID="lblDocName" runat="server" Text='<%#Eval("Name") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadUpload ID="ruDocument" runat="server" MaxFileInputsCount="1" />
                        <asp:CustomValidator ID="cvDocument" runat="server" ClientValidationFunction="validateRadUpload"
                            ErrorMessage="Please select a file" Display="Dynamic" />
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Description" UniqueName="Description">
                    <ItemTemplate>
                        <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadTextBox ID="txtDescription" runat="server" Text='<%# Bind("Description") %>'
                            Columns="50" Rows="5" TextMode="MultiLine" />
                        <des:RequiredTextValidator ID="rtvDescription" runat="server" ControlIDToEvaluate="txtDescription"
                            ErrorMessage="* Required" />
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn HeaderText="Date Created" DataField="CreatedDate" ReadOnly="true"
                    DataFormatString="{0:d}" />
                <telerik:GridBoundColumn HeaderText="Operator" DataField="CreatedBy" ReadOnly="true" />
                <telerik:GridImageColumn ImageUrl="~/Images/Tick.gif" HeaderText="Archived?" UniqueName="ArchivedColumn" />
                <telerik:GridTemplateColumn ReadOnly="true" UniqueName="ViewColumn">
                    <ItemTemplate>
                        <asp:HyperLink ID="hypView" runat="server" Text="View" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn ButtonType="PushButton" />
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
 
<telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Skin="Default" />
<telerik:RadAjaxManagerProxy ID="ajaxProxy" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdMediaLibrary" LoadingPanelID="loadingPanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
Mira
Telerik team
 answered on 25 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?