This is a migrated thread and some comments may be shown as answers.

Insert/Update from usercontrol in templatecolumn

0 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
first last
Top achievements
Rank 1
first last asked on 08 Dec 2008, 11:22 PM
Hi,

I have a 
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<%@ Register src="WebUserControl.ascx" tagname="WebUserControl" tagprefix="uc1" %> 
 
<!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></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"  
            AllowSorting="True" GridLines="None"  
            onneeddatasource="RadGrid1_NeedDataSource" AllowAutomaticDeletes="True"  
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True"  
            AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True"
<HeaderContextMenu EnableTheming="True"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</HeaderContextMenu> 
 
<MasterTableView> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
<Columns> 
<telerik:GridTemplateColumn HeaderText="someheader"
<ItemTemplate> 
some user control 
</ItemTemplate> 
<EditItemTemplate> 
<uc1:WebUserControl ID="WebUserControl1" runat="server" /> 
</EditItemTemplate> 
</telerik:GridTemplateColumn> 
</Columns> 
</MasterTableView> 
 
            <ClientSettings> 
                <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
            </ClientSettings> 
 
<FilterMenu EnableTheming="True"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
        </telerik:RadGrid> 
    </div> 
     
    </form> 
</body> 
</html> 


And the usercontrol:



<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
<asp:ListBox ID="ListBox1"  SelectionMode="Multiple" runat="server"
    <asp:ListItem>12</asp:ListItem> 
    <asp:ListItem>3</asp:ListItem> 
    <asp:ListItem>45</asp:ListItem> 
    <asp:ListItem>5</asp:ListItem> 
    <asp:ListItem>5</asp:ListItem> 
    <asp:ListItem>44</asp:ListItem> 
    <asp:ListItem>3434</asp:ListItem> 
</asp:ListBox> 
 

how do i get the values from the listbox in the usercontrol when performing a save or update? and how do i select pre-defined values(the ones saved in an edit to a db) in the listbox when displaying it in itemtemplate?


 

No answers yet. Maybe you can help?

Tags
Grid
Asked by
first last
Top achievements
Rank 1
Share this question
or