Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
106 views
RadEditor version: 2009.2.701.35

I'm using the RadEditor in an ASP.NET MVC application and everything is working fine.  This is going to be a community application that allows users to post articles and such.

When a user posts an article using the RadEditor, if they upload an image to be used in the posting, I want that image to be uploaded to a folder with their user name.

Example:

Root Image upload folder: ~/UploadedImages

Folders for users:
~/UploadedImages/joe/myimage1.jpg
~/UploadedImages/joe/myimage2.jpg

~/UploadedImages/susan/myimage1.jpg
~/UploadedImages/susan/myimage2.jpg

~/UploadedImages/frank/myimage1.jpg
~/UploadedImages/frank/myimage2.jpg

etc...

I realize that I don't have access to the nice code-behind like in WebForms, and I've been looking through the Clientside API, but I can't find a good way of doing this.

Is this possible with ASP.NET MVC?

Thanks.
King Wilder
Top achievements
Rank 2
 answered on 15 Oct 2009
4 answers
252 views
I have a radgrid bound to a database containing geographical data:
Location (ex. "London")
Latitude
Longitude

The grid displays the Location field, and in a NestedViewTemplate, I display a Google Map with a marker set at the latitude/longitude coordinate.

To only allow one item to be expanded at a time, I have enabled "Single Expand" according to this article:
http://www.telerik.com/help/aspnet-ajax/grdsingleexpandinhierarchicalgrid.html

What I'd like:

1. To be able to collapse the single expanded item. Right now I can't do that. Here is my current ItemCommand eventhandler:

If e.CommandName = "ExpandCollapse" Then 
    For Each item As GridItem In e.Item.OwnerTableView.Items 
        If item.Expanded = True Then 
            item.Expanded = False 
        End If 
    Next 
End If 


2. To ajaxify the grid to prevent full-page refreshes when I expand a new item. Right now it fires an "access is denied" error if I try to ajaxify using a radAjaxManager.

A simple project that replicates my problem can be downloaded from http://www.stmtest.net/GoogleMapsGrid.zip

Note: Telerik dll's are not included in the /bin folder in .zip

Any ideas appreciated,
Jeppe Jespersen
Denmark



Soren Michelsen
Top achievements
Rank 1
 answered on 15 Oct 2009
1 answer
80 views
hello,
actually i am facing a serious problem with my application performance that using TelerikAjax Controls 3.5

I have a master page contains RadAjaxManager and RadScriptManager
also aso I alreaddy added BrowserFile.browser contains following lines

<browsers>

    <browser refID="Default">

        <controlAdapters>

            <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadHiddenFieldPageStateCompression" />

            <!--Uncomment the following line to use SessionStateCompression and remove ViewState from the page-->

          <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadSessionPageStateCompression" />

        </controlAdapters>

    </browser>

</browsers>

and I set debug=false in web.config

but unfortunatilly application performance still too bad wit size range between 1.5 to 1.9 MB

user sometimes need to wait 15 seconds to see the requested page and this is not accepted by users side
I have radGrids,trees,and another simple controls
my master file has RadTreeView in addition to RadAjaxManager and RadScript manager
my home page that takes 1.5 MB has 2 RadGrids with some textboxes...etc

really I would appreciate any quick help,
Ihab Yasin
ehabcom007@yahoo.com
Pavlina
Telerik team
 answered on 15 Oct 2009
3 answers
153 views
Hi. I want to be able to load a grid based on the selection of two radCombo boxes but I want to force the user to click an update button which loads the grid on the client based on the selections in the radCombo. I am new to the Telerik suite. I saw the demo on how to load the grid based on the user changing the selection of a radCombo but that does an automatic load. i want the user to click an update button.

Any insight would be beneficial to me...

thanks
Tsvetoslav
Telerik team
 answered on 15 Oct 2009
1 answer
110 views

 

Hi,

I'm using  a demo call update/insert/delete when the EnableViewState property of the grid is set to false.

If i press cancel  button ni editform anyway insert record.

Wha can i do?

Regards...


protected
void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

if (e.CommandName == RadGrid.UpdateCommandName)

 

{

RadGrid1.DataSource =

null;

 

}

 

else if (e.CommandName == RadGrid.EditCommandName)

 

{

Session[

"initEdit"] = true;

 

Session[

"updateFlag"] = true;

 

}

 

else if (e.CommandName == RadGrid.InitInsertCommandName)

 

{

Session[

"insertFlag"] = true;

 

}

 

else if(e.CommandName == RadGrid.DeleteCommandName)

 

{

 

string ID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"].ToString();

 

 

DataTable employeesTable = (DataTable)Session["employeesTable"];

 

 

if (employeesTable.Rows.Find(ID) != null)

 

{

employeesTable.Rows.Find(ID).Delete();

employeesTable.AcceptChanges();

Session[

"employeesTable"] = employeesTable;

 

}

}

}



 

 

protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

 

if(Session["updateFlag"] != null && Session["initEdit"] != null)

 

{

 

DataTable employeesTable = (DataTable)Session["employeesTable"];

 

 

for (int i = 0; i < RadGrid1.EditIndexes.Count; i++)

 

{

 

GridDataItem dataItem = RadGrid1.MasterTableView.Items[RadGrid1.EditIndexes[i]] as GridDataItem;

 

 

GridEditableItem editItem = (dataItem.OwnerTableView.EditMode == GridEditMode.InPlace) ? (GridEditableItem)dataItem : (GridEditableItem)dataItem.EditFormItem;

 

 

GridEditManager mng = editItem.EditManager;

 

 

foreach (GridColumn column in dataItem.OwnerTableView.Columns)

 

{

 

if (column is IGridEditableColumn)

 

{

 

IGridEditableColumn editedColumn = column as IGridEditableColumn;

 

 

IGridColumnEditor editor = mng.GetColumnEditor(editedColumn);

 

 

string editorType = editor.ToString();

 

 

string editorText = null;

 

 

if (editor is GridTextColumnEditor)

 

{

editorText = (editor

as GridTextColumnEditor).Text;

 

}

 

try

 

 

 

 

 

{

 

DataRow[] changedRows = employeesTable.Select("EmployeeID = " + editItem.OwnerTableView.DataKeyValues[editItem.ItemIndex]["EmployeeID"]);

 

changedRows[0][column.UniqueName] = editorText;

}

 

catch (Exception ex)

 

{

RadGrid1.Controls.Add(

new LiteralControl("Unable to update Employee. Reason: " + ex.Message));

 

}

}

}

}

employeesTable.AcceptChanges();

Session[

"employeesTable"] = employeesTable;

 

Session[

"updateFlag"] = false;

 

Session[

"editIndex"] = null;

 

}

 

else if (Session["insertFlag"] != null)

 

{

 

DataTable employeesTable = (DataTable)Session["employeesTable"];

 

 

DataRow newRow = employeesTable.NewRow();

 

 

GridEditableItem insertItem = RadGrid1.MasterTableView.GetInsertItem();

 

 

GridEditManager mng = insertItem.EditManager;

 

 

foreach (GridColumn column in insertItem.OwnerTableView.Columns)

 

{

 

if (column is IGridEditableColumn)

 

{

 

IGridEditableColumn editedColumn = column as IGridEditableColumn;

 

 

IGridColumnEditor editor = mng.GetColumnEditor(editedColumn);

 

 

string editorType = editor.ToString();

 

 

string editorText = null;

 

 

if (editor is GridTextColumnEditor)

 

{

editorText = (editor

as GridTextColumnEditor).Text;

 

}

 

try

 

 

 

 

 

{

newRow[column.UniqueName] = editorText;

}

 

catch (Exception ex)

 

{

RadGrid1.Controls.Add(

new LiteralControl("Unable to insert into Employees. Reason: " + ex.Message));

 

}

}

}

 

//This should not be applied when updating directly the database

 

 

 

 

 

newRow[

"EmployeeID"] = (int)employeesTable.Rows[employeesTable.Rows.Count - 1]["EmployeeID"] + 1;

 

employeesTable.Rows.Add(newRow);

Session[

"employeesTable"] = employeesTable;

 

Session[

"insertFlag"] = null;

 

}

Session[

"initEdit"] = null;

 

RadGrid1.DataSource = (

DataTable)Session["employeesTable"];

 

}

Sebastian
Telerik team
 answered on 15 Oct 2009
4 answers
184 views
I updated my telerik controls for one of my .net vb.net projects to  version 2009.2.826.20 and now it seems the force postback for a button within a grid template column within an ajaxified radGrid is no longer doing the regular postback. I was previously using a pretty old version, that involved including a dll like RadGrid.Net2.dll. Anyway, below is my code that previously worked with the older version. When I updated the controls, I also went through and re-added the ScriptManager (on Master Page) and the radAjaxManager and the radGrid to the page and reset its settings, after I brought in the new telerik controls DLL. With the new version, the controls within the grid that are supposed to run ajaxified are working fine. But now it seems when I click the button, it does an ajax postback, instead of the regular postback I am trying to force. If I add an EnableAjax="false" to the radAjaxManger, everything runs without error, but obviously now it no longer does ajax postbacks for other controls within the grid that I want to use Ajax.

 
<script type="text/javascript"> 
 
function realPostBack(eventTarget, eventArgument) 
{ 
__doPostBack(eventTarget, eventArgument); 
} 
 
</script> 
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  DefaultLoadingPanelID="AjaxLoadingPanel1"> 
     <AjaxSettings> 
 
         <telerik:AjaxSetting AjaxControlID="rdgResults"> 
             <UpdatedControls> 
                 <telerik:AjaxUpdatedControl ControlID="rdgResults" LoadingPanelID="AjaxLoadingPanel1" />   
             </UpdatedControls> 
         </telerik:AjaxSetting> 
        </AjaxSettings>        
    </telerik:RadAjaxManager> 
     
<asp:panel id="pnlsearch" runat="server" DefaultButton="btnSearch"> 
... 
 <telerik:RadGrid ID="rdgResults" runat="server" AllowPaging="True" AllowSorting="True" EnableEmbeddedSkins="False" Skin="radGridSkin" Width="100%" EnableOutsideScripts="True" GridLines="None"> 
    <MasterTableView AutoGenerateColumns="False" AllowNaturalSort="False" NoMasterRecordsText="No Special Permission Requests Found." 
            PageSize="20"   DataKeyNames="RequestID" BorderColor="#B5E9AD"> 
... 
<Columns> 
... 
            <telerik:GridTemplateColumn UniqueName="tmpEditColumn"> 
             <HeaderTemplate> 
                            Edit 
                        </HeaderTemplate> 
                        <ItemTemplate> 
                            <div class="functionButtons"> 
                                <asp:Button runat="server" Text="" CssClass="btnEdit" ID="btnEdit"  CommandName="EditCustom"  /> 
                            </div> 
                        </ItemTemplate> 
            </telerik:GridTemplateColumn>                                    
         </Columns> 
 
       </MasterTableView> 
  
    
    </telerik:RadGrid> 
 
<asp:panel id="pnlReqEntry" runat="server"> 


Code to add the postback call to the button within the grid

   Protected Sub rdgResults_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rdgResults.ItemCreated 
        If (TypeOf e.Item Is GridDataItem) Then 
            Dim dataItem As GridDataItem = CType(e.Item, GridDataItem) 
            Dim button1 As Button = CType(dataItem("tmpEditColumn").FindControl("btnEdit"), Button) 
 
           
            button1.Attributes.Add("onclick", String.Format("realPostBack('{0}', '{1}'); return false;", button1.UniqueID, button1.CommandArgument)) 
             
        End If 
    End Sub 

and in my web.config:

    <compilation debug="true"> 
      <assemblies> 
        <add assembly="Telerik.Web.Design, Version=2009.2.826.20, Culture=neutral, PublicKeyToken=121FAE78165BA3D4" /> 
        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      </assemblies> 
    </compilation> 
<httpHandlers> 
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI, Version=2009.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" verb="*" validate="false" /> 
    </httpHandlers> 
  </system.web> 
  <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <handlers> 
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" /> 
    </handlers> 


viewing the html source (had to set EnableAjax=false to even see this within the source html) for the button that should do a normal postback looks like:

  <input type="button" name="ctl00$ContentPlaceHolder1$rdgResults$ctl00$ctl04$btnEdit" value="" onclick="realPostBack('ctl00$ContentPlaceHolder1$rdgResults$ctl00$ctl04$btnEdit', ''); return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$rdgResults$ctl00$ctl04$btnEdit&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" id="ctl00_ContentPlaceHolder1_rdgResults_ctl00_ctl04_btnEdit" class="btnEdit" />


Is there something that has changed, regarding forcing postbacks with the newest version of the radGrid?

Paul J
Top achievements
Rank 1
 answered on 15 Oct 2009
1 answer
173 views
Hi,

Using the FileExplorer, I want to control the permitted behaviour for each item (file or directory).

Basically I am implementing a directory browser with download capability  BUT I need to restrict what can be downloaded bsed on a combination of file attributes and which user is logged in.

Using a custom provider, I can add attributes (and additional columns) to the grid - one of these indicates visually to the user whether they can perform a download (i.e. all the logic has been applied to determine whether they can download the item).

I have further implemented a test in the "Handler" so that if the user does try to "open" the item they are ignored. However I would like to go further and catch the attempt on the client side (maybe pop-up a window saying not allowed).

  1. However I note that on the client, I can't seem to get to the additional attributes which have been defined (presumably I could go through some convoluted steps to get the grid and then get the column from it), surely a clientside "Get_Attribute(name)" method would make sense?
  2. I also note that I cna't set the permissions of the file item on the server side (e.g. whilst processing the file items in the custom provider I tried setting the permissions and discover that they are readonly). Woudl it not be sensible to be able to control permission on each file tiem individually?

Andrew

Fiko
Telerik team
 answered on 15 Oct 2009
1 answer
89 views
Does anyone know if the Fast Navigation functionality is supported in a Multi-Calendar view.

I.E. I wish to display one year at a time.

It works OK with a single month, however as soon as either the MultiViewColumns or MultiViewRows is changed from 1 (i.e. 3 and 4) the Fast Navigation stops working

Thanks

Andrew
 
Pavlina
Telerik team
 answered on 15 Oct 2009
2 answers
146 views
Hi,
I'm using a RadComboBox bind by WebService wich is into a RadContextMenu ItemTemplate :

    
    <telerik:RadContextMenu ID="RCMU" runat="server" ... > 
        <Items> 
            ... 
            <telerik:RadMenuItem Value="5"> 
                <ItemTemplate> 
                    <telerik:RadComboBox ID="CMRDDLC" runat="server"  
                        ShowMoreResultsBox="false" EnableVirtualScrolling="true" EnableItemCaching="true"  
                        EnableTextSelection="true" EnableViewState="False"  
                        EnableLoadOnDemand="true" ZIndex="10000" 
                        OnClientItemsRequesting="OnClientItemsRequesting"> 
                        <WebServiceSettings  Path="~/.asmx" Method="GetMethod" /> 
                        <CollapseAnimation Duration="100" Type="OutQuint" /> 
                    </telerik:RadComboBox> 
                </ItemTemplate> 
            </telerik:RadMenuItem> 
            ... 
        </Items> 
    </telerik:RadContextMenu> 

So far, everything is going well.

But when I click on an element of the RadComboBox, the DropDownList is hidden and the context menu too, and I want the menu stays open.

I've tried codes as "set_cancel(true)" to stop the click event propagation on radComboBox but nothing works, I also tried to find wich element cause the close of the contextual menu but i haven't find methods that helps, any ideas ?


Best regards

EDIT: I'm using Q1 2009 (402.35) :)




Yana
Telerik team
 answered on 15 Oct 2009
1 answer
72 views

I recently purchased the AJAX RADControls since read that it is one of the best AJAX libraries available.

I am trying to move my web apps into AJAX. I use server controls only for the initial page rendering of the DOM elements and then make web-service calls (using PageMethods or WCF) to populate or manipulate any grids, forms or data that exist in the page.

I added some of the Telerik controls to replace plain HTML tags (such as drop-down lists, inputs, etc.) but it is difficult it is to find these controls in the DOM in order to manipulate them (especially when they are embedded within other ASP.Net server controls).

To find a Telerik Control I have to resort to such calls as:
 
var combo = $find("<%= RadComboBox1.ClientID %>");
var item = combo.findItemByText(text);

(By the way, this code above will NOT run when you place your script code in a separate JS file which is a best practice that I prefer to follow.)

I am trying to use these controls for 100% strictly data access via AJAX.
I don't need the ASP.Net engine to assign them an ID in the DOM, I want to control this ID myself so that I can more easily access them from my scripts.

Can I define my own Client IDs when I place controls on a page declaratively or programmatically?

Can I assign the Client IDs of the RADControls when using ASP.NET MVC?

Let me know if this level of control is possible with RADControls.

Klaus Barkhausen

Georgi Krustev
Telerik team
 answered on 15 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?