Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
138 views
Hi,
 Just a small question, but can you advise briefly on the technical steps required to upgrade the MOSS Editor Lite to the Full Commercial version - I'd like to use the lite version ASAP while a business case is raised for the purchase of the full version, but want to be sure in the meanwhile that if we upgrade later, the existing content created wont be lost.

 Thanks,
Jason.
Lini
Telerik team
 answered on 19 Dec 2009
2 answers
168 views
Hi Gang,

I've implemented the solution documented on one of your blog to load on demand the RadComboBox with a MVC JSON request. 

I'm having a hard time trying to figure out if and how I can group entries server side (or even on the client).

Any help would be greatly appreciated :)

Regards,

LF
Laurent Fabre
Top achievements
Rank 2
 answered on 19 Dec 2009
3 answers
169 views
I have the OnClientNodeClicked subscribed to a function which calls the toggle method on the node.  However, the node is only toggling when the user clicks the inner text of the node (rtIn).  How can I make the node toggle when any part of the node panel is clicked?  Similar to the way the menu in the Telerik Demo page works on the left hand side.  Any help would be appreciated.  I've included some code to further illustrate.  Thank you.

<telerik:RadTreeView runat="server" ID="trtvLeftNav" LoadingStatusPosition="BeforeNodeText" Skin="TreeLeft" 
    AllowNodeEditing="False" EnableDragAndDrop="false" EnableEmbeddedSkins="false" 
    EnableEmbeddedBaseStylesheet="false" OnClientDoubleClick="OnClientDoubleClickHandler" 
    OnClientNodeExpanding="toggleHandler" OnClientNodeCollapsing="toggleHandler" 
    OnClientNodeClicked="OnClientNodeClickedHandler"
    <Nodes> 
        <telerik:RadTreeNode runat="server" Text="Our Products" ExpandMode="ClientSide"
        </telerik:RadTreeNode> 
        <telerik:RadTreeNode runat="server" Text="Root Node" ExpandMode="ClientSide"
            <nodes> 
                <telerik:RadTreeNode runat="server" Text="Child Node" ExpandMode="ClientSide"
                </telerik:RadTreeNode> 
            </nodes> 
        </telerik:RadTreeNode> 
        <telerik:RadTreeNode runat="server" Text="Root Node 2" ExpandMode="ClientSide"
        </telerik:RadTreeNode> 
    </Nodes> 
</telerik:RadTreeView> 
<script type="text/javascript"
var cancel = false
 
function toggleHandler(sender, eventArgs) 
    eventArgs.set_cancel(cancel); 
    cancel = false
 
function OnClientDoubleClickHandler(sender, eventArgs) 
    cancel = true
 
function OnClientNodeClickedHandler(sender, eventArgs)  
{  var node = eventArgs.get_node();  
   node.toggle();      
}  
</script> 

Brad H
Top achievements
Rank 2
 answered on 18 Dec 2009
5 answers
243 views
Hi All,

I need help. I am using RadGrid for Read News page. I want to display one news per page. Also, I have an other page which is news list display. what I am doing is: when user click news title(from news list page) open my read news page(it has RadGrid) and display that news, also on the bottom have page navigator, which is user click next news it will open next news.
My problem is I cannot open user clicked news. It always open my last news. So, I need some one help me to fix this problem.

Thanks.
Nurmemet Suleiman
Top achievements
Rank 1
 answered on 18 Dec 2009
1 answer
108 views
Where's the HeaderTemplate support in RadListBox?  This functionality exists in RadComboBox.  I don't want all the functionality of a datagrid, just a listbox with columns and a header.  Anyone else want to see this?

Thanks,
Karlin

Simon
Telerik team
 answered on 18 Dec 2009
6 answers
171 views
I am working on a project that requires an administrator to set the layout of custom user controls for use on a client facing portal.  I started using this example

When the end-user views the page there should be no dock functionality, so, can all the dock functionality such as drag/drop, layout styling and minimize/close be removed?  Or should I just parse the JSON that gets stored in the db and load the controls that way?

Thanks.
Alex
Top achievements
Rank 1
 answered on 18 Dec 2009
4 answers
152 views
Dear All,

I manage to open radwindow from code-behind after assigning the NavigationUrl to an aspx page.

The navigationUrl contains parameters for the aspx to extract and work with.

On the aspx I place a button to close the radwindow, when I hover the move over it, it displays the parameters passed to the page in the IE statusbar.

How can I disable it from displaying the parameters in the IE statusbar

Thanks and best regards
Waleed
Waleed Seada
Top achievements
Rank 2
 answered on 18 Dec 2009
5 answers
186 views
I have Master Page I use with certain projects. I add AjaxManager to the a content page and when I configure it shows no controls in the project. I have tried to move the Manager to all the different MasterPage areas with no luck. From what I've read I should be able to run ajax on any controls within the same content area without any problems. I am using AjaxManager v2009.2.826.35. Here is a test sample:

 

 

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Login.aspx.vb" Inherits="_Default" title="Untitled Page" %> 
 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
 
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    &nbsp; &nbsp;&nbsp; &nbsp;<br /> 
    <br /> 
    <telerik:RadDatePicker ID="RadDatePicker1" Runat="server"   
        Culture="English (United States)">  
<Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar> 
 
<DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton> 
    </telerik:RadDatePicker> 
    <br /> 
    <br /> 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"   
        GridLines="None" Width="228px">  
<MasterTableView AutoGenerateColumns="False" DataKeyNames="ID"   
            DataSourceID="SqlDataSource1">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID"   
            ReadOnly="True" SortExpression="ID" UniqueName="ID">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DevDesc" HeaderText="DevDesc"   
            SortExpression="DevDesc" UniqueName="DevDesc">  
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
        ConnectionString="<%$ ConnectionStrings:SCCSDConnectionString %>"   
        SelectCommand="SELECT [ID], [DevDesc] FROM [tblDevices]">  
    </asp:SqlDataSource> 
    <br /> 
    <telerik:RadAjaxManager runat="server">  
    </telerik:RadAjaxManager> 
</asp:Content> 

How do I correct this problem>

Pavlina
Telerik team
 answered on 18 Dec 2009
1 answer
107 views
I'm getting some script errors trying to use the CDN on a site in IE6 (sadly it was a requirement)

Anyway, switching to asp:ScriptManager solves the problem

I've got the 2 Telerik jQuery Libs and the MSAjax librarys linked in the definition

Anyone else have any issues?
Veselin Vasilev
Telerik team
 answered on 18 Dec 2009
3 answers
150 views

I am having a problem with the data being cleared out of the controls in the edit form template when a button is clicked on the template. (In the actual application, other events can also clear the objects on the form.) I have created two views on the form to show that the problem occurs with both asp type controls and telerik type controls (see Example 1.)  The window on the left side has a telerik:radcontrolbox, asp:listbox, and an asp: button. The window on the right side has a asp:dropdownlist, asp:listbox, and an asp: button. It doesn’t matter which button is clicked (except for Cancel), all of the listbox, radcontrolbox, and dropdownlist controls are cleared out (see Example 2.) The controls on the top of the form are not in the edit form template and are not affected by this problem. I have supplied the ASPX and ASPX.VB below for your review and solution.

To reproduce the problem, click the “Edit” button to display the edit form template and then click the “Add” button or the “Update” button (which was setup to error instead of update during the test phase.) After clicking the “Add” button the form refreshes and the list boxes, the dropdown list, and the radcontrolbox no longer have values in them.


I have researched this problem for a week and have not been able to come up with a solution. I have seen countless answers on how to solve similar issues but none have given an answer that solved the problem in my application. I have tried everything I have read without a solution so I hope that if someone can help me, they will supply me the changes I need to make to my code and not provide me with a link that I’ve probably already been to.


============ 
Publish.aspx 
============ 
 
<%@ Page Language="VB" MasterPageFile="~/MasterPage.Master" AutoEventWireup="false" CodeFile="Publish.aspx.vb" Inherits="Publish" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ MasterType VirtualPath="~/MasterPage.Master" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="cphBody" Runat="Server"
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <script language="JavaScript" type="text/javascript" src="include/commonGrid.js"></script> 
    <table cellspacing="0" cellpadding="0" width="600" border="0"
        <tr> 
            <td style="FONT:bold 14pt tahoma">Publish Templates</td> 
        </tr> 
    </table> 
    <br /> 
    <div id="divPage" runat="server"
        <span class="defaultText">Filter by organization:</span>&nbsp;<asp:DropDownList id="ddlOrganization" runat="server" CssClass="dropDownList" DataTextField="Name" DataValueField="OrganizationId" 
                AutoPostBack="True" OnSelectedIndexChanged="ddlOrganization_SelectedIndexChanged" />&nbsp;<asp:CheckBox ID="cbxActiveOnly" runat="server" AutoPostBack="True" Text="Show active only" Checked="true" /> 
        <br />&nbsp;<br /> 
    </div> 
 
  <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" 
      AllowAutomaticInserts="True" PageSize="10" OnItemDataBound="RadGrid1_ItemDataBound" OnItemCommand="RadGrid1_ItemCommand" 
      AllowSorting="true" AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False" 
      DataSourceID="SqlDataSource1" OnItemUpdated="RadGrid1_ItemUpdated" OnDataBound="RadGrid1_DataBound" 
      OnItemInserted="RadGrid1_ItemInserted" ShowStatusBar="true" OnPreRender="RadGrid1_PreRender"
      <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView CommandItemDisplay="TopAndBottom" EditMode="EditForms" 
                DataKeyNames="PublishTemplateId" DataSourceID="SqlDataSource1" EnableNoRecordsTemplate="true"
                <NoRecordsTemplate>There are no templates to display.</NoRecordsTemplate> 
                <Columns> 
                    <telerik:GridEditCommandColumn ButtonType="PushButton" /> 
                    <telerik:GridBoundColumn UniqueName="FileName" HeaderText="FileName" DataField="FileName" ReadOnly="True"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="Description" HeaderText="Description" DataField="Description" ReadOnly="True"
                    </telerik:GridBoundColumn> 
                </Columns> 
 
          <EditFormSettings EditFormType="Template"
            <FormTemplate> 
                            <asp:HiddenField ID="hPublishTemplateID" Value='<%# Bind( "PublishTemplateID" ) %>' runat="server" /> 
                            <table><tr><td> 
                            <!--column 1--> 
              <table id="Table1" cellspacing="2" cellpadding="1" width="420" border="2" rules="none" 
                style="border-collapse: collapse; background: white;"
                                <tr> 
                                    <td valign="top" align="right">Work Types:&nbsp;</td> 
                                    <td valign="top" align="center"><asp:ListBox Rows="5" runat="server" ID="workTypeListBox1" Height="100px" Width="200px" /></td
                                    <td valign="top" align="left"><telerik:RadComboBox ID="ddlWorkTypes1" runat="server" CssClass="dropDownList" DataTextField="Name" DataValueField="WorkTypesId" AutoPostBack="true" OnSelectedIndexChanged="ddlWorkTypes_SelectedIndexChanged" /> 
                                    <br /><asp:Button ID="btnAddWorkType1" Text="Add" runat="server" CausesValidation="False" CommandName="AddWorkType1" OnClick="btnAddWorkType_Clicked" /></td
                                </tr> 
                <tr> 
                  <td colspan="3" align="right"
                    <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' 
                      runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' /> 
                    &nbsp; 
                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
                      CommandName="Cancel" /> 
                  </td> 
                </tr> 
              </table> 
              </td><td
                            <!--column 2--> 
              <table id="Table2" cellspacing="2" cellpadding="1" width="420" border="2" rules="none" 
                style="border-collapse: collapse; background: white;"
                                <tr> 
                                    <td valign="top" align="right">Work Types:&nbsp;</td> 
                                    <td valign="top" align="center"><asp:ListBox Rows="5" runat="server" ID="workTypeListBox2" Height="100px" Width="200px" /></td
                                    <td valign="top" align="left"><asp:DropDownList ID="ddlWorkTypes2" runat="server" CssClass="dropDownList" DataTextField="Name" DataValueField="WorkTypesId" AutoPostBack="true" OnSelectedIndexChanged="ddlWorkTypes_SelectedIndexChanged" /> 
                                    <br /><asp:Button ID="btnAddWorkType2" Text="Add" runat="server" CausesValidation="False" CommandName="AddWorkType2" OnClick="btnAddWorkType_Clicked" /></td
                                </tr> 
                <tr> 
                  <td colspan="3" align="right"
                    <asp:Button ID="Button2" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' 
                      runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' /> 
                    &nbsp; 
                    <asp:Button ID="Button3" Text="Cancel" runat="server" CausesValidation="False" 
                      CommandName="Cancel" /> 
                  </td> 
                </tr> 
              </table> 
              </td></tr></table> 
            </FormTemplate> 
            <EditColumn UniqueName="EditCommandColumn1"
            </EditColumn> 
          </EditFormSettings> 
                 
            </MasterTableView> 
  </telerik:RadGrid> 
     
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
        ConnectionString="<%$ ConnectionStrings:DBReadConnection %>" 
        UpdateCommandType="StoredProcedure" UpdateCommand="Publish_Update" 
        InsertCommandType="StoredProcedure" InsertCommand="Publish_Update"  
        SelectCommandType="StoredProcedure" SelectCommand="Publish_Select"
 
         <SelectParameters> 
             <asp:ControlParameter Name="ai_i_OrganizationId" ControlID="ddlOrganization" PropertyName="SelectedValue" DefaultValue="-1" /> 
         </SelectParameters> 
 
        <UpdateParameters> 
            <asp:Parameter Name="ai_i_OrganizationId" Type="Int32" /> 
            <asp:Parameter Name="ai_vc_Description" Type="String" /> 
            <asp:Parameter Name="ai_vc_FileName" Type="String" /> 
        </UpdateParameters> 
         
        <InsertParameters> 
            <asp:Parameter Name="ai_i_OrganizationId" Type="Int32" /> 
            <asp:Parameter Name="ai_vc_Description" Type="String" /> 
            <asp:Parameter Name="ai_vc_FileName" Type="String" /> 
        </InsertParameters> 
         
    </asp:SqlDataSource>     
 
</asp:Content> 
 
=============== 
Publish.aspx.vb 
=============== 
 
Imports System.Web.UI.WebControls 
Imports System.Data 
Imports Telerik.Web.UI 
Imports System.Drawing 
 
Partial Class Publish 
    Inherits System.Web.UI.Page 
 
#Region " Global Page Variables " 
    Public Shared gint_OrganizationId As Integer = -1 
    Public Shared gstr_buttonClickedID As String = "" 
    Protected Shared gddlID As String = "" 
    Protected Shared gddlSelectedText As String = "" 
    Protected Shared gddlSelectedValue As String = "" 
    Protected Shared gddlSelectedIndex As Integer = -1 
#End Region 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
        If Not Page.IsPostBack Then 
            BindOrganizationList() 
        End If 
    End Sub 
 
    Private Sub AddWorkType(ByRef workTypeListBox As ListBox, ByVal ddlID As String) 
        'add a work type to the list box 
        If gddlSelectedIndex > -1 And gddlID = ddlID Then 
            workTypeListBox.Items.Add(gddlSelectedText) 
            gddlID = "" 'reset state 
            gddlSelectedIndex = -1  'reset state 
        End If 
    End Sub 
 
    Public Sub BindOrganizationList() 
        'build organization dropdown list based on user type 
        Dim ds As New DataSet 
 
        Try 
            Dim clsOrganizationDB As New OrganizationDB(CommonFunctions.UserId) 
            ds = clsOrganizationDB.GetOrganizationDropDownList() 
            ddlOrganization.DataSource = ds 
            ddlOrganization.DataBind() 
 
            Try 
                ddlOrganization.SelectedIndex = 0 
                gint_OrganizationId = ddlOrganization.SelectedValue 
            Catch 
                gint_OrganizationId = 0 
            End Try 
 
        Catch sqlex As SqlClient.SqlException 
            SetMessage("BindOrganizationList() Failed: " & sqlex.ToString) 
        Catch ex As Exception 
            SetMessage("BindOrganizationList() Failed: " & ex.ToString) 
        End Try 
    End Sub 
 
    Private Sub BindWorkTypeList(ByRef ddlObj As Object, ByVal i_active As Integer, ByVal boxType As String) 
        'build work type radcombobox list based on organization 
        Try 
            Dim ddlWorkTypes As Object 
            ddlWorkTypes = ddlObj 
            If boxType = "rcb" Then 'RadComboBox 
                ddlWorkTypes = DirectCast(ddlWorkTypes, RadComboBox) 
            Else 
                'dropdown list 
                ddlWorkTypes = DirectCast(ddlWorkTypes, DropDownList) 
            End If 
            ddlWorkTypes.Items.Clear()  'clear current list 
            Dim storedProc As String = "SEL_WorkTypes" 
            Dim dbConn As New SqlClient.SqlConnection(CommonFunctions.GetREADConnectionString()) 
            dbConn.Open() 
            Dim sqlCmd As SqlClient.SqlCommand = dbConn.CreateCommand() 
            sqlCmd.CommandType = CommandType.StoredProcedure 
            sqlCmd.CommandText = storedProc 
            sqlCmd.Parameters.Add("ai_i_OrganizationId", SqlDbType.Int).Value = gint_OrganizationId 
            sqlCmd.Parameters.Add("ai_i_IsActive", SqlDbType.Int).Value = i_active 
            sqlCmd.Connection = dbConn 
            Dim sa As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(sqlCmd) 
            Dim dt = New DataTable 
            sa.Fill(dt) 
            Dim dv As DataView = New DataView(dt) 
            dv.Sort = "Description" 
 
            'build list here 
            ddlWorkTypes.DataSource = dv 
            ddlWorkTypes.DataTextField = "Description" 
            ddlWorkTypes.DataValueField = "TranscriptionWorkTypeID" 
            ddlWorkTypes.DataBind() 
 
            If boxType = "rcb" Then 'RadComboBox 
                ddlWorkTypes.Items.Insert(0, New RadComboBoxItem("Select Work Type", "")) 
            Else 
                'dropdown list 
                ddlWorkTypes.Items.Insert(0, New ListItem("Select Work Type", "")) 
            End If 
            dbConn.Close() 
 
        Catch sqlex As SqlClient.SqlException 
            SetMessage("BindWorkTypeList() Failed: " & sqlex.ToString) 
        Catch ex As Exception 
            SetMessage("BindWorkTypeList() Failed: " & ex.ToString) 
        End Try 
    End Sub 
 
    Private Sub BindWorkTypeListBox(ByRef workTypeListBox As ListBox, ByVal i_PublishTemplateId As Integer) 
        'build work type listbox based on xref with publish template 
        'hidden listbox contains IDs for updating database 
        Try 
            workTypeListBox.Items.Clear()   'clear current list 
            Dim item As New ListItem() 
            Dim storedProc As String = "Publish_SelectWorkType" 
            Dim dbConn As New SqlClient.SqlConnection(CommonFunctions.GetREADConnectionString()) 
            dbConn.Open() 
            Dim sqlCmd As SqlClient.SqlCommand = dbConn.CreateCommand() 
            sqlCmd.CommandType = CommandType.StoredProcedure 
            sqlCmd.CommandText = storedProc 
            sqlCmd.Parameters.Add("ai_i_PublishTemplateId", SqlDbType.Int).Value = i_PublishTemplateId 
            sqlCmd.Connection = dbConn 
            Dim sdr As SqlClient.SqlDataReader = sqlCmd.ExecuteReader() 
 
            'initialize listboxes 
            While workTypeListBox.SelectedIndex <> -1 
                workTypeListBox.Items.Remove(workTypeListBox.SelectedItem.Value) 
            End While 
 
            'load listboxes 
            While sdr.Read 
                workTypeListBox.Items.Add(CStr(sdr.Item("Description"))) 
            End While 
            dbConn.Close() 
            workTypeListBox.DataBind() 
 
        Catch sqlex As SqlClient.SqlException 
            SetMessage("BindWorkTypeListBox() Failed: " & sqlex.ToString) 
        Catch ex As Exception 
            SetMessage("BindWorkTypeListBox() Failed: " & ex.ToString) 
        End Try 
    End Sub 
 
    Protected Sub ddlOrganization_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) 
        gint_OrganizationId = ddlOrganization.SelectedValue 'update global value 
        RadGrid1.Rebind() 
        RadGrid1.MasterTableView.ClearEditItems()   'force items out of edit mode so that update/cancel buttons are hidden on initial load 
    End Sub 
 
    Private Sub DisplayMessage(ByVal text As String) 
        RadGrid1.Controls.Add(New LiteralControl(String.Format("<span style='font-weight:bold;color:red'>{0}</span>", text))) 
    End Sub 
 
    Private gridMessage As String = Nothing 
 
    Protected Sub RadGrid1_DataBound(ByVal sender As Object, ByVal e As EventArgs) 
        If Not String.IsNullOrEmpty(gridMessage) Then 
            DisplayMessage(gridMessage) 
        End If 
    End Sub 
 
    Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) 
        'a button has been clicked 
        gstr_buttonClickedID = e.CommandName 
 
        If gstr_buttonClickedID = "AddWorkType1" Or gstr_buttonClickedID = "AddWorkType2" Then 
            RadGrid1.DataSource = Nothing 
            'call the Rebind() method after nullifying the data source 
            RadGrid1.Rebind()   'force itemdatabound event on events that don't cause them 
        End If 
    End Sub 
 
    Protected Sub btnAddWorkType_Clicked(ByVal sender As Object, ByVal e As EventArgs) 
        'just a place keeper so that the itemcommand can fire and then the 
        'itemdatabound will fire next and the worktype will be added 
    End Sub 
 
    Protected Sub ddlWorkTypes_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) 
        'dropdown list changed 
        Dim sName As String = sender.GetType.Name 
        Dim ddl As Object 
        If sName = "RaComboBox" Then 
            ddl = DirectCast(ddl, RadComboBox) 
        Else 
            ddl = DirectCast(ddl, DropDownList) 
        End If 
        ddl = sender 
        If ddl.SelectedIndex > -1 Then 
            'save the results because they will be lost when the "add" button is clicked 
            gddlID = ddl.ID 
            gddlSelectedText = ddl.SelectedItem.Text.ToString 
            gddlSelectedValue = ddl.SelectedItem.Value.ToString 
            gddlSelectedIndex = ddl.SelectedIndex 
        Else 
            gddlID = "" 
            gddlSelectedIndex = -1 
        End If 
    End Sub 
 
    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) 
        'active when a button is clicked on the form 
        'objects are located here when a grid editable item is in edit mode otherwise you can't find these objects behind the radgrd 
        If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then 
            'edit type button has been clicked 
            'setup fields for conditional postback and validation 
            Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem) 
 
            'do nothing unless an event has been initiated by user 
            If gstr_buttonClickedID <> "" Then 
                'setup objects for different button clicks 
                Dim workTypeListBox1 As ListBox = DirectCast(e.Item.FindControl("workTypeListBox1"), ListBox) 
                Dim workTypeListBox2 As ListBox = DirectCast(e.Item.FindControl("workTypeListBox2"), ListBox) 
                Dim ddlWorkTypes1 As RadComboBox = DirectCast(e.Item.FindControl("ddlWorkTypes1"), RadComboBox) 
                Dim ddlWorkTypes2 As DropDownList = DirectCast(e.Item.FindControl("ddlWorkTypes2"), DropDownList) 
                '<asp:DropDownList id="ddlWorkTypes" runat="server" CssClass="dropDownList" DataTextField="Name" DataValueField="WorkTypesId" 
                '                   AutoPostBack="True" OnSelectedIndexChanged="ddlWorkTypes_SelectedIndexChanged" /> 
 
                If gstr_buttonClickedID = "Edit" Then 
                    'bind list boxes in edit template 
                    Dim hPublishTemplateID As HiddenField = DirectCast(e.Item.FindControl("hPublishTemplateID"), HiddenField) 
                    Dim publishTempID As Integer = CInt(hPublishTemplateID.Value) 
                    BindWorkTypeListBox(workTypeListBox1, publishTempID) 
                    BindWorkTypeListBox(workTypeListBox2, publishTempID) 
 
                    'bind ddl's in edit template 
                    Dim i_active = 1 'only get active work types 
                    BindWorkTypeList(ddlWorkTypes1, i_active, "rcb")    'setup ddlWorkTypes dropdown list 
                    BindWorkTypeList(ddlWorkTypes2, i_active, "ddl")    'setup ddlWorkTypes dropdown list 
 
                ElseIf gstr_buttonClickedID = "AddWorkType1" Then 
                    'add a work type to the listbox 
                    AddWorkType(workTypeListBox1, "ddlWorkTypes1") 
 
                ElseIf gstr_buttonClickedID = "AddWorkType2" Then 
                    'add a work type to the listbox 
                    AddWorkType(workTypeListBox2, "ddlWorkTypes2") 
 
                End If 
                gstr_buttonClickedID = ""   'reset 
            End If 
 
        End If 
    End Sub 
 
    Protected Sub RadGrid1_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) 
        'template insert 
        If Not e.Exception Is Nothing Then 
            e.ExceptionHandled = True 
            e.KeepInInsertMode = True 
            SetMessage("Template cannot be inserted. Reason: " + e.Exception.Message) 
        Else 
            SetMessage("New template is inserted!") 
        End If 
    End Sub 
 
    Protected Sub RadGrid1_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) 
        'template update 
        If Not e.Exception Is Nothing Then 
            e.KeepInEditMode = True 
            e.ExceptionHandled = True 
            SetMessage("Template cannot be updated. Reason: " + e.Exception.Message) 
        Else 
            Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem) 
            Dim id As String = item.GetDataKeyValue("PublishTemplateId").ToString() 
            SetMessage("Template with ID " + id + "is updated!") 
        End If 
    End Sub 
 
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) 
 
    End Sub 
 
    Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) 
        If (Not Page.IsPostBack) Then 
            Dim i As Integer 
            For i = 0 To RadGrid1.PageSize - 1 
                RadGrid1.EditIndexes.Add(i) 
            Next i 
            BindOrganizationList() 
            Me.RadGrid1.MasterTableView.Rebind() 
            RadGrid1.Rebind() 
        End If 
    End Sub 
 
    Private Sub SetMessage(ByVal message As String) 
        gridMessage = message.Replace(vbCrLf, "<br />") 
    End Sub 
 
End Class 
 



Pavlina
Telerik team
 answered on 18 Dec 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?