Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
327 views
I need to insert/update/delete records programmatically. Here is my code

ascx:

<%

@ Control Language="C#" Inherits="YourCompany.Modules.Tahakkuk.ViewTahakkuk" AutoEventWireup="true" CodeBehind="ViewTahakkuk.ascx.cs" %>

 

<%

@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

 

 

Namespace="System.Web.UI" TagPrefix="asp" %>

 

<%

@ Register Assembly="Telerik.Web.UI, Version=2009.1.527.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"

 

 

Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function RowDblClick(sender, eventArgs)

 

{

sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());

}

 

</script>

 

 

</telerik:RadCodeBlock>

 

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadGrid1">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGrid1" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

 

 

<

telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"

 

AllowSorting

="True" AutoGenerateColumns="true" AllowPaging="True" GridLines="None" ShowFooter="True" AllowMultiRowSelection="True"

 

 

PageSize="7" AllowMultiRowEdit="True" AllowAutomaticInserts="True" OnItemDeleted="RadGrid1_ItemDeleted">

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

<MasterTableView Width="100%" CommandItemDisplay="Top"

 

 

DataKeyNames="HizmetID">

 

 

<CommandItemTemplate>

 

 

<div style="padding: 5px 5px;">

 

Custom command item template

&nbsp;&nbsp;&nbsp;&nbsp;

 

 

<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'>Edit selected</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'>Update</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'>Cancel editing</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'>Add new</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton3" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'> Add this Customer</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected customers?')"

 

 

runat="server" CommandName="DeleteSelected">Delete selected customers</asp:LinkButton>&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid">Refresh customer list</asp:LinkButton>

 

 

 

</div>

 

 

</CommandItemTemplate>

 

 

</MasterTableView>

 

 

<ClientSettings>

 

 

<Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />

 

 

</ClientSettings>

 

</

telerik:RadGrid>

 



And all i have in ascx.cs is as follows:

protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)
        {
            e.ExceptionHandled = true;
        }

 

protected void Page_Load(object sender, System.EventArgs e)

 

{


EntityCollection

<HizmetEntity> hizmet = new EntityCollection<HizmetEntity>();  // Here is how i get an     collection     to     use     as     a source for my RadGrid

 

DBAdapter.FetchEntityCollection(hizmet,

null);

 

 

 

RadGrid1.DataSource = hizmet;

RadGrid1.MasterTableView.DataSource = hizmet;

RadGrid1.DataBind();


}

private

DataAccessAdapter _dbAdapter;

 

 

private DataAccessAdapter DBAdapter

 

{

 

get

 

{

 

if (_dbAdapter == null)

 

{

_dbAdapter =

new DataAccessAdapter();

 

_dbAdapter.ConnectionString =

"";

 

}

 

return _dbAdapter;

 

}

}


What should i do to handle insert/delete/update?  Where and how should i relate RadGrid to my programmatically created DataSource and its insert/update/delete query?

Thanks in advance...
Kem Arda
Top achievements
Rank 1
 answered on 14 Jul 2009
3 answers
185 views
Hi:

I am trying to place a raddock in a specific area of a web page (I don't want to use top and left properties of the raddock), when I look at the source code of the web page it always create the following style: 'position:absolute,top:0,left:0' , how I can either remove the absolute position or set it to relative and also remove the top and left properties, because I need to place the dock below an anchor control.

Also I have a radeditor inside a raddock, I would like to resize the dock control while resizing the editor or the otherway round.

Thanks
Jim
Top achievements
Rank 1
 answered on 14 Jul 2009
1 answer
249 views
Can one use this new control in an MVC application and if so how and could you post a small working application?

TIA, Tom
Lini
Telerik team
 answered on 14 Jul 2009
7 answers
336 views
hi,

How can I replace RadNumericTextbox (attached with client event OnValueChanged) with RadInputManager and Asp:Textbox? As InputManager only exposes "OnBlur, OnError, OnFocus and OnKeyPress" events.

Thanks

Ali
Iana Tsolova
Telerik team
 answered on 14 Jul 2009
5 answers
104 views
Hi All,
         I want to be able to advance the end time by a certain time duration determined by a value in the database. Is there anyway I can achieve this ?

Thanks,
Aditya


Peter
Telerik team
 answered on 14 Jul 2009
2 answers
204 views
Hello,
       I am using RadEditor and saving its content in database. but while i retrieve that content it always show a single line space between all lines.
Editor is declared as
<telerik:RadEditor ID="rdEditorAppMethods" runat="server" Height="385px" Width="330px" EditModes="Design " 
EnableResize="False" Skin="Office2007" ToolsFile="~/Editor/ToolsFile.xml" OnClientCommandExecuting="OnClientCommandExecuting1" 
ContentAreaCssFile="EditorContentArea.css">  
<Content></Content>  
</telerik:RadEditor> 

Can someone help me to detect this problem.

Thanks,
Pinkey
Pinkey
Top achievements
Rank 1
 answered on 14 Jul 2009
1 answer
78 views
Hi,
 With the lite version it's not possible to browse the parent site for images elsewhere. This was raised as a support question for the full version but no answer was received to it other than to install the latest version. I'm currently using Editor Lite version 4.5.6 I believe.

 Obviously we can insert an image at the current site and edit the HTML, but would prefer it to be a little simpler than that.

Thanks,
Jason.
Stanimir
Telerik team
 answered on 14 Jul 2009
1 answer
116 views
Hi,
 If the Full Featured RadEditor is supposed to be a direct replacement for the standard MOSS Content Editor Web Part, where are all the fonts? From the drop down there is a very limited selection, whereas the standard version pretty much lists all of them. The font I'm looking to use in this great editor is Trebuchet MS, but it doesn't appear to be available on your demo area at the link below, or within the 'Lite' version also. Is this a configuration change/issue?

http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx

Thanks,
Jason.
Stanimir
Telerik team
 answered on 14 Jul 2009
1 answer
120 views
 Hi,
 I m using the latest version of calendar from Telerik. The issue is when I move my mouse over TODAY,OK,CANCEL button in month/year navigation popup the button style changes and I dont want like that. How to do it ?

Let me know

Thanks 
Dimo
Telerik team
 answered on 14 Jul 2009
2 answers
354 views
Hi,
I have a RadContextMenu attached to a RadGrid with 3 options: add, edit and delete the selected row. I use the "OnClientItemClicking" othe RadContextMenu to enable/disable some properties depending on a datakey of the selected row. This works fine as well...until...
  1. if I use the method RadGrid.get_masterTableView().showInsertItem() the editform shows beautifuly
  2. if I then cancel the insert operation, I can't get the radcontextmenu back again. Instead of firing the "OnClientItemClicking" when I right-click the grid it fires the "OnRowContextMenu" event of the grid and bypasses the "OnClientItemClicking"

What I am trying to do is automatically select the first row (if there is one) after the cancel link of the insert has been selected. I can't seem to catch the event client side and am using the Server Side CancelCommand to set a flag that selects the first row in the PreRender event. This works but then I lose the context menu.

Any Ideas?

Regards
Roger

Monalisa
Top achievements
Rank 1
 answered on 14 Jul 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?