Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
175 views
Hi,

My problem

1) How do i update, insert and delete from my radgrid using custom edit template?

I have provided the following coding, any help or example is much appreciated.

The following coding is using the 3 tier model and is a web user control to be used in share point.

thank you

UI


<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CLManagement.ascx.cs" Inherits="CLManagement" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2008.2.723.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="DemoProject.BLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4d6fe3d9b7315a53"
    Namespace="DemoProject.BLL" TagPrefix="BLL" %>   
<%@ Register Assembly="DemoProject.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=49aaa8eb85eb2046"
    Namespace="DemoProject.DAL" TagPrefix="DAL" %>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="False">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="CLRadTabStrip">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="CLRadTabStrip" />
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

<telerik:RadAjaxPanel ID="CLRadAjaxPanel" runat="server" Height="200px" Width="100%">

<telerik:RadTabStrip ID="CLRadTabStrip" runat="server" SelectedIndex="3" Skin="Telerik" Width="100%" OnTabClick="CLRadTabStrip_TabClick">
    <Tabs>
        <telerik:RadTab runat="server" Text="State" Value="CLState">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Race" Value="CLRace">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Citizen" Value="CLCitizen">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Religion" Value="CLReligion" Selected="True">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Bank" Value="CLBank">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Product Type" Value="CLProductType">
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="0" Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" GridLines="None" ShowFooter="True" ShowStatusBar="True" Skin="Telerik" Width="100%" OnInsertCommand="Radgrid1_InsertCommand" OnUpdateCommand="Radgrid1_UpdateCommand">
        <FooterStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <AlternatingItemStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <ItemStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <PagerStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <MasterTableView CommandItemDisplay="Bottom" GridLines="None">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn ColumnEditorID="Code" HeaderText="Code" UniqueName="Code">
                    <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
                        Font-Strikeout="False" Font-Underline="False" Wrap="True" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn ColumnEditorID="Description" HeaderText="Description" UniqueName="Description">
                    <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
                        Font-Strikeout="False" Font-Underline="False" Wrap="True" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn ColumnEditorID="Status" HeaderText="Status" UniqueName="Status">
                    <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
                        Font-Strikeout="False" Font-Underline="False" Wrap="True" />
                </telerik:GridBoundColumn>
                <telerik:GridEditCommandColumn HeaderText="Edit">
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn HeaderText="Delete" Text="Delete" UniqueName="Delete">
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
 <FormTemplate>
   <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0">
   
    <tr><td><table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
    <tr><td>Code:</td>
    <td><telerik:RadTextBox ID="tbRadCode" runat="server" Text='<%# Bind( "Code" ) %>'></telerik:RadTextBox></td></tr>
    <tr><td>Description:</td>
    <td><telerik:RadTextBox ID="tbRadDesc" runat="server" Text='<%# Bind( "Description") %>' TabIndex="1"></telerik:RadTextBox></td></tr>
    <tr><td>Status:</td>
    <td><telerik:RadTextBox ID="tbRadStatus" runat="server" Text='<%# Bind( "Status") %>' TabIndex="2"></telerik:RadTextBox></td></tr>
    </table></td></tr>
   
    <tr><td align="right" colspan="1">
    <asp:Button ID="btSubmit" runat="server" Font-Bold="True" Text="Submit" commandname="Radgrid1_UpdateCommand"></asp:Button>&nbsp;
    <asp:Button ID="btCancel" runat="server" Text="Cancel" Font-Bold="True" commandname="Cancel"></asp:Button></td>
     </tr></table>
                    </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <SelectedItemStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <GroupHeaderItemStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
        <FilterMenu EnableTheming="True" Skin="Telerik">
            <CollapseAnimation Duration="200" Type="OutQuint" />
        </FilterMenu>
        <EditItemStyle Font-Bold="False" Font-Italic="False" Font-Names="Arial" Font-Overline="False"
            Font-Strikeout="False" Font-Underline="False" Wrap="True" />
    </telerik:RadGrid></telerik:RadAjaxPanel>  


Code Behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using DemoProject.BLL;

[System.ComponentModel.Description("CLManagement")]

public partial class CLManagement : System.Web.UI.UserControl
{
    BLLCodeList _bllCL = new BLLCodeList();

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void CLRadTabStrip_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)
    {
        //DataTable dt = ;dt.DefaultView;
        RadGrid1.DataSource = _bllCL.searchCLTable(CLRadTabStrip.SelectedTab.Value.ToString(), "", "");
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "Id" };
        RadGrid1.DataBind();
    }

    protected void Radgrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
        string Code = (insertedItem["Code"].Controls[0] as TextBox).Text;
        string Description = (insertedItem["Description"].Controls[0] as TextBox).Text;
        _bllCL.insertCLTable(CLRadTabStrip.SelectedTab.Value.ToString(), "Code", "Description", HttpContext.Current.User.Identity.Name);
    }

    protected void Radgrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        string Description = (editedItem.FindControl("tbRadDesc") as TextBox).Text;
        _bllCL.updateCLTable(CLRadTabStrip.SelectedTab.Value.ToString(), "Description", "");

    }
}
Princy
Top achievements
Rank 2
 answered on 02 Sep 2008
1 answer
133 views
I have a form that has 2 rad comboboxes each bound to its own datasource control.
The second RadCombo's datasource's select parameter takes its value from the SelectdValue of the first RadCombo and then is suposed to supply a new list of items to the second RadCombo.

The second RadCombo also has 1 Static Item and has the AppendDataBoundItems set to "true"

The problem is when I change the selectedInmdex of the first RadCombo and the second RadCombo gets databound, it then Adds the new Items to the second RadCombo instead of replacing them

So as a user clicks and clicks at the different items of the first RadCombo, the list item of the secon Radcombo keep on growing and the items even get duplicated if the same listitem on the first RadCombo gets clicked more than once.

It needs to first clear the list of items before it rebind to the new data.

How do I do this?

<asp:ObjectDataSource ID="ObjectDataSource2" runat="server"

SelectMethod="GetAdSubCats" TypeName="MB.TheBeerHouse.BLL.Ads.AdSubCat">

<SelectParameters>

<asp:ControlParameter ControlID="CatSelect" Name="AdCatID" PropertyName="SelectedValue"

Type="Int32" />

</SelectParameters>

</asp:ObjectDataSource>


<

telerik:RadComboBox ID="SubcatSelect" runat="server"

DataSourceID="ObjectDataSource2" DataTextField="Title" DataValueField="ID"

AppendDataBoundItems="True" AutoPostBack="True" Skin="Hay">

<Items>

<telerik:RadComboBoxItem Text="Select an Ad Heading" Value="0" />

</Items>

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadComboBox>

Yana
Telerik team
 answered on 02 Sep 2008
1 answer
123 views
Hello,

I've uninstalled ASP.NET AJAX using the program own uninstall shortcut. After the uninstall completed I've noticed that it left entries in windows Add/Remove form. Trying to uninstall again from windows add/remove result in an error 1602. The failed uninstall did remove the entry from the list of installed application so I hope it is uninstalled completly.

Regards,
Tzach
Daniel
Telerik team
 answered on 02 Sep 2008
3 answers
351 views
Hi,

I'm beginning to use RadGrid with a LinqDataSource. The binding of the grid works just fine. Now I want to insert a hyperlink-column into the grid which displays the name of a user and when it's clicked the user's profile page is displayed.

In my aspx file I added the column like this:
<telerik:GridHyperLinkColumn DataTextField="aspnet_User.UserName" HeaderText="User" DataNavigateUrlFields="http://google.de"
                    SortExpression="aspnet_User" UniqueName="aspnet_User">
 </telerik:GridHyperLinkColumn>

Now, the problem is, that there is no text displayed in the grid. It seems that
the DataTextField property is not working (but it is working in a GridBoundColumn).
Another problem is, how to prepare the NavigateUrl property to use the userId.

Edit: I tried to add the GridHyperLinkColumn Programmatically via the RadGrid_ItemDataBound() evend handler but it seems that the handler never
gets called.

Thanks in advance for any hints.
Best regards,
Robert
Princy
Top achievements
Rank 2
 answered on 02 Sep 2008
3 answers
318 views
It seems the new date picker that is available does not use the FirstDayOfWeek that is specified on the scheduler, its very confusing to have the scheduler start on Monday but the date picker start on Sunday.


Peter
Telerik team
 answered on 02 Sep 2008
3 answers
115 views
Hello,

I'm using Telerk's ASP.NET AJAX Q2 2008 controls for a project at our firm and I've encountered an unexpected behavior when using the RadTreeView control:
The treeview's ShowLineImages property is set to false and I'm using ServerSideCallback as expand mode for every node in the treeview.
When a node is expanded it is populated with child nodes and it's ExpandMode property is set to ClientSide.
The newly-expanded node is linked to its child nodes with image lines, allthough the treeview's ShowLineImages property is set to false. When a full postback is performed the lines dissapear.
I have followed the coding guide from the RadTreeView documentation when using the treeview control. Is there a posibility that I have missed something or is this a known issue? In case it's a known issue is there a way of correcting it through client-side code?

Thanks,

Adi Muresan
misoft-systems
Atanas Korchev
Telerik team
 answered on 02 Sep 2008
3 answers
117 views

Is there any way to stop user interaction with a Ajax control while the browser is finishing loading the page.

I have a control that uses some in page JavaScript but if the page is not fully loaded the JavaScript fails.

Thanks in advance

Dimo
Telerik team
 answered on 02 Sep 2008
1 answer
71 views
Hi,
I am using RadGrid for Asp.Net ajax, now i have requirement as i want to insert RadTree in to the grid row and these trees are different for each RadGrid Row.
I am using DataSet as satasource for binding Grid. So could you  please tell me what should be the Stored procedure structure so i can bind data easily to tree.

Thanks and regard,
sagar
Princy
Top achievements
Rank 2
 answered on 02 Sep 2008
6 answers
247 views

Hi,
Just started working on Telerik Controls and was using the RadGrid for a few days now. My Requirement was to show "extra information" in form of Labels and Images in the Grid after a row is collapsed by clicking the "+" or "arrow" icon. I found the following example helpful:

http://demos.telerik.com/aspnet/prometheus/Grid/Examples/Hierarchy/NestedViewTemplate/DefaultCS.aspx

but even if I copy the whole code and test it I cannot collapse an expanded row when I click nothing happens. I tried adding different controls in the NestedViewTemplate and found out that when I place a button there and click it (after expanding), the row collapses. What does that mean? What am I missing here?

Here is my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="myExperiments._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 runat="server">  
<title>Experiment Page</title> 
</head> 
<body> 
    <form id="myForm" runat="server" method="post">  
 
    <telerik:RadScriptManager ID="myScriptMngr" runat="server" EnableTheming="True">  
    </telerik:RadScriptManager> 
 
    <telerik:RadAjaxManager ID="myRadAjaxManager" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="myRadGrid">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="myRadGrid" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
 
                  
    <telerik:RadGrid ID="myRadGrid" runat="server" 
        GridLines="None" Skin="Default2006" Width="500px"   
        AutoGenerateColumns="False">  
<MasterTableView AllowMultiColumnSorting="True">  
<NestedViewTemplate> 
   <p> 
        <asp:DetailsView ID="myDetailsView" runat="server" Width="125px" ></asp:DetailsView> 
    </p> 
</NestedViewTemplate> 
 
<RowIndicatorColumn Visible="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn Resizable="False">  
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
 
    <Columns> 
        <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False"   
            DataField="Column1" HeaderText="Column 1" ShowSortIcon="False"   
            UniqueName="column">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column2" HeaderText="Column 2"   
            UniqueName="column1">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column3" HeaderText="Column3"   
            UniqueName="column2">  
        </telerik:GridBoundColumn> 
    </Columns> 
 
<EditFormSettings> 
<PopUpSettings ScrollBars="None"></PopUpSettings> 
</EditFormSettings> 
</MasterTableView> 
    </telerik:RadGrid> 
   
    </form> 
    </body> 
</html> 
Princy
Top achievements
Rank 2
 answered on 02 Sep 2008
1 answer
71 views
I have a RadDatePicker in a rtl page, which is close to the right side of the browser.
When the popup button is pressed, the calendar appear from the button towards the right, thus leaving the browser right side. The horizontal scrollbar is activated, but can only scroll left, which doesn't help.
Is there a way to make the calendar appear towards the left?

tnx for any replay.
Princy
Top achievements
Rank 2
 answered on 02 Sep 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?