or
| Private _conn As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString) |
| Private ReadOnly Property CurrentDockStates() As List(Of DockState) |
| Get |
| 'Get saved state string from the database - set it to dockState variable for example |
| Dim dockStatesFromDB As String = "" |
| _conn.Open() |
| Dim command As New SqlCommand("select State from States where id='" + Me.DropDownList1.SelectedValue.ToString + "'", _conn) |
| dockStatesFromDB = command.ExecuteScalar().ToString() |
| _conn.Close() |
| Dim _currentDockStates As New List(Of DockState)() |
| Dim stringStates As String() = dockStatesFromDB.Split("|"c) |
| For Each stringState As String In stringStates |
| If stringState.Trim() <> String.Empty Then |
| _currentDockStates.Add(DockState.Deserialize(stringState)) |
| End If |
| Next |
| Return _currentDockStates |
| End Get |
| End Property |
| Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init |
| 'Recreate the docks in order to ensure their proper operation |
| Dim i As Integer = 0 |
| While i < CurrentDockStates.Count |
| If CurrentDockStates(i).Closed = False Then |
| Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i)) |
| 'We will just add the RadDock control to the RadDockLayout. |
| ' You could use any other control for that purpose, just ensure |
| ' that it is inside the RadDockLayout control. |
| ' The RadDockLayout control will automatically move the RadDock |
| ' controls to their corresponding zone in the LoadDockLayout |
| ' event (see below). |
| 'We want to save the dock state every time a dock is moved. |
| CreateSaveStateTrigger(dock) |
| 'Load the selected widget |
| LoadWidget(dock) |
| RadDockLayout1.Controls.Add(dock) |
| End If |
| System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1) |
| End While |
| End Sub |
| Protected Sub RadDockLayout1_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs) |
| 'Populate the event args with the state information. The RadDockLayout control |
| ' will automatically move the docks according that information. |
| For Each state As DockState In CurrentDockStates |
| e.Positions(state.UniqueName) = state.DockZoneID |
| e.Indices(state.UniqueName) = state.Index |
| Next |
| End Sub |
| Protected Sub RadDockLayout1_SaveDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs) |
| Dim stateList As List(Of DockState) = Me.RadDockLayout1.GetRegisteredDocksState() |
| Dim serializedList As New StringBuilder() |
| Dim i As Integer = 0 |
| While i < stateList.Count |
| serializedList.Append(stateList(i).ToString()) |
| serializedList.Append("|") |
| System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1) |
| End While |
| Dim dockState As String = serializedList.ToString() |
| If dockState.Trim() <> [String].Empty Then |
| _conn.Open() |
| Dim command As New SqlCommand([String].Format("update States set State='{0}' where id='" + Me.DropDownList1.SelectedValue.ToString + "'", dockState), _conn) |
| command.ExecuteNonQuery() |
| _conn.Close() |
| End If |
| End Sub |
| Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock |
| Dim dock As New RadDock() |
| dock.DockMode = DockMode.Docked |
| dock.ID = String.Format("RadDock{0}", state.UniqueName) |
| dock.ApplyState(state) |
| dock.EnableAnimation = True |
| dock.Commands.Add(New DockCloseCommand) |
| dock.Commands.Add(New DockExpandCollapseCommand()) |
| Return dock |
| End Function |
| Private Function CreateRadDock() As RadDock |
| Dim docksCount As Integer = CurrentDockStates.Count |
| Dim dock As New RadDock() |
| dock.DockMode = DockMode.Docked |
| dock.UniqueName = Guid.NewGuid().ToString() |
| dock.ID = String.Format("RadDock{0}", dock.UniqueName) |
| dock.Title = Replace(Replace(DroptDownWidget.SelectedItem.Text, ".ascx", ""), "_", " ") |
| dock.EnableAnimation = True |
| dock.Text = String.Format("Added at {0}", DateTime.Now) |
| dock.Width = Unit.Pixel(386) |
| dock.Commands.Add(New DockCloseCommand()) |
| dock.Commands.Add(New DockExpandCollapseCommand()) |
| dock.CommandsAutoPostBack = True |
| Return dock |
| End Function |
| Private Sub CreateSaveStateTrigger(ByVal dock As RadDock) |
| 'Ensure that the RadDock control will initiate postback |
| ' when its position changes on the client or any of the commands is clicked. |
| 'Using the trigger we will "ajaxify" that postback. |
| dock.AutoPostBack = True |
| dock.CommandsAutoPostBack = True |
| Dim updatedControl As New AjaxUpdatedControl() |
| updatedControl.ControlID = "Panel1" |
| Dim setting1 As New AjaxSetting(dock.ID) |
| setting1.EventName = "DockPositionChanged" |
| setting1.UpdatedControls.Add(updatedControl) |
| Dim setting2 As New AjaxSetting(dock.ID) |
| setting2.EventName = "Command" |
| setting2.UpdatedControls.Add(updatedControl) |
| RadAjaxManager1.AjaxSettings.Add(setting1) |
| RadAjaxManager1.AjaxSettings.Add(setting2) |
| End Sub |
| Private Sub LoadWidget(ByVal dock As RadDock) |
| If String.IsNullOrEmpty(dock.Tag) Then |
| Return |
| End If |
| Dim widget As Control = LoadControl(dock.Tag) |
| dock.ContentContainer.Controls.Add(widget) |
| End Sub |
| Protected Sub ButtonAddDock_Click(ByVal sender As Object, ByVal e As EventArgs) |
| Dim dock As RadDock = CreateRadDock() |
| 'find the target zone and add the new dock there |
| Dim dz As RadDockZone = DirectCast(XMLUtilities.FindControlRecursive(Master, "RadDockZone1"), RadDockZone) |
| dz.Controls.Add(dock) |
| CreateSaveStateTrigger(dock) |
| 'Load the selected widget in the RadDock control |
| dock.Tag = DroptDownWidget.SelectedValue |
| LoadWidget(dock) |
| ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "MoveDock", String.Format("function _moveDock() {{" & vbCr & vbLf & vbTab & vbTab & vbTab & " " & vbTab & "Sys.Application.remove_load(_moveDock);" & vbCr & vbLf & vbTab & vbTab & vbTab & vbTab & " $find('{1}').dock($find('{0}'),{2});" & vbCr & vbLf & vbTab & vbTab & vbTab & " }};" & vbCr & vbLf & vbTab & vbTab & vbTab & " Sys.Application.add_load(_moveDock);", "$find('<%= RadDock1.ClientID %>');", "RadDockZone1", dz.Docks.Count), True) |
| End Sub |
Hi Team,
I am not able to retain value of combobox when i click on "Click Me" in my code. Please help me. My code as below.
Code Behind Code:-
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| Protected Sub rcbSections_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs) Handles rcbCat.ItemDataBound |
| Dim CustomExamID As String = CType(e.Item.FindControl("chk"), CheckBox).Attributes("CategoryID") |
| If ViewState("CategoryID") <> CustomExamID Then |
| ViewState("CategoryID") = CustomExamID |
| Dim CustomExamTitle As String = CType(e.Item.FindControl("chk"), CheckBox).Attributes("CategoryName") |
| Dim objSectionItem As New RadComboBoxItem |
| objSectionItem.Value = CustomExamID |
| objSectionItem.Text = CustomExamTitle |
| objSectionItem.IsSeparator = True |
| rcbCat.Items.Insert(e.Item.Index, objSectionItem) |
| rcbCat.Items(e.Item.Index - 1).Controls.Remove(rcbCat.Items(e.Item.Index - 1).FindControl("chk")) |
| Dim objTitle As New LiteralControl() |
| objTitle.ID = "lcCategoryName" |
| objTitle.Text = CustomExamTitle |
| rcbCat.Items(e.Item.Index - 1).Controls.Add(objTitle) |
| End If |
| End Sub |
| Private Sub FillCategory() |
| Dim dtMaster As New DataTable("Item") |
| dtMaster.Columns.Add("CategoryID") |
| dtMaster.Columns.Add("CategoryName") |
| dtMaster.Columns.Add("SubCategoryID") |
| dtMaster.Columns.Add("SubCategoryName") |
| For index As Integer = 1 To 10 |
| For index1 As Integer = 1 To 3 |
| Dim drNew As DataRow |
| drNew = dtMaster.NewRow() |
| drNew("CategoryID") = index |
| drNew("CategoryName") = "CategoryName" + index.ToString |
| drNew("SubCategoryID") = index1 |
| drNew("SubCategoryName") = "SubCategoryName" + index1.ToString |
| dtMaster.Rows.Add(drNew) |
| Next |
| Next |
| rcbCat.DataSource = dtMaster |
| rcbCat.DataTextField = "SubCategoryName" |
| rcbCat.DataValueField = "SubCategoryID" |
| rcbCat.DataBind() |
| End Sub |
| Protected Sub btnFillCat_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFillCat.Click |
| FillCategory() |
| End Sub |
| End Class |
Design Code :-
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <!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> |
| <telerik:radscriptblock runat="server" id="scriptBlock"> |
| <script type="text/javascript"> |
| var cancelDropDownClosing = false; |
| function onDropDownClosing() { |
| cancelDropDownClosing = false; |
| } |
| function onSectionCheckBoxClick() { |
| var combo = $find("<%= rcbCat.ClientID %>"); |
| //prevent second combo from closing |
| cancelDropDownClosing = true; |
| //holds the text of all checked items |
| var text = ""; |
| //holds the values of all checked items |
| var values = ""; |
| //get the collection of all items |
| var items = combo.get_items(); |
| //enumerate all items |
| for (var i = 0; i < items.get_count(); i++) { |
| var item = items.getItem(i); |
| //get the checkbox element of the current item |
| var chk1 = $get(combo.get_id() + "_i" + i + "_chk"); |
| if (chk1) { |
| if (chk1.checked) { |
| text += item.get_text() + ","; |
| values += item.get_value() + ","; |
| } |
| } |
| } |
| //remove the last comma from the string |
| text = removeLastComma(text); |
| values = removeLastComma(values); |
| if (text.length > 0) { |
| //set the text of the combobox |
| combo.set_text(text); |
| combo.set_value(values); |
| } |
| else { |
| //all checkboxes are unchecked |
| //so reset the controls |
| combo.set_text("All Category"); |
| combo.set_value("All"); |
| } |
| } |
| function StopPropagation(e) { |
| if (!e) { |
| e = window.event; |
| } |
| e.cancelBubble = true; |
| } |
| //this method removes the ending comma from a string |
| function removeLastComma(str) { |
| return str.replace(/,$/, ""); |
| } |
| </script> |
| </telerik:radscriptblock> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <div style="color: Red;width:500px;text-align:justify;"> |
| <b>Note:- </b> First Fill the Combobox by clicking on "Fill Category" then select calegories |
| from combobox using checkbox. After this click on "Click Me". Then open the combobox |
| you will see the Separator have checkbox and category name will disapper. |
| </div> |
| <br /> |
| <asp:Button runat="server" Text="Fill Category" ID="btnFillCat" /><br /><br /> |
| <asp:Button runat="server" Text="Click Me" ID="btnClick" /> |
| <br /> |
| <br /> |
| <br /> |
| <telerik:radcombobox id="rcbCat" runat="server" height="140px" showtoggleimage="True" |
| highlighttemplateditems="true" onclientload="onSectionCheckBoxClick" width="290px" |
| style="vertical-align: middle;" expandanimation-type="None" collapseanimation-type="None" |
| allowcustomtext="false" onclientdropdownclosed="onDropDownClosing"> |
| <ItemTemplate> |
| <div onclick="StopPropagation(event)"> |
| <asp:CheckBox runat="server" ID="chk" Text='<%# Eval("SubCategoryName") %>' Value='<%# Eval("SubCategoryID") %>' |
| CategoryID='<%# Eval("CategoryID") %>' CategoryName='<%# Eval("CategoryName") %>' |
| TextAlign="right" onclick="onSectionCheckBoxClick()" /> |
| </div> |
| </ItemTemplate> |
| </telerik:radcombobox> |
| </div> |
| <telerik:radajaxmanager runat="server" id="ramTest"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="rcbCat"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rcbCat" LoadingPanelID="rlpCR" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:radajaxmanager> |
| </form> |
| </body> |
| </html> |
I am waiting for you reply.
Thanks
Chirag Patel
| // Find the RadControl client object, if null then exit the function |
| sb.Append(String.Format("var co = $find(\"{0}\");", c.ClientID)); |
| sb.Append("if (co == null) return;"); |
| Is parket te combineren met vloerverwarming? |
| Ja, mits het parket hiertoe geschikt is, dan is het te combineren met vloerverwarming zowel als bijverwarming als hoofdverwarming |
| Is parket te combineren met vloerverwarming?<br /> |
| <br /> |
| Ja, mits het parket hiertoe geschikt is, dan is het te combineren met vloerverwarming zowel als bijverwarming als hoofdverwarming |
| <p>Is parket te combineren met vloerverwarming?</p> |
| <p>Ja, mits het parket hiertoe geschikt is, dan is het te combineren met vloerverwarming zowel als bijverwarming als hoofdverwarming</p> |
| <div>Is parket te combineren met vloerverwarming?</div> |
| <div><br /> |
| </div> |
| <div>Ja, mits het parket hiertoe geschikt is, dan is het te combineren met vloerverwarming zowel als bijverwarming als hoofdverwarming</div> |
| <%@ Register Assembly="Telerik.Web.UI, Version=2008.2.723.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <telerik:RadCalendar runat="server"></telerik:RadCalendar> |
| Type 'Telerik.Web.UI.RadCalendar' is not defined. |

| <telerik:RadGrid ID="radGrid1" runat="server" Skin="Forest" AllowFilteringByColumn="True" AllowPaging="True" |
| AllowSorting="True" |
| AutoGenerateColumns="False" |
| DataSourceID="ObjectDataSource1" |
| GridLines="None" |
| ShowGroupPanel="True"> |
| <MasterTableView AllowMultiColumnSorting="True" |
| AutoGenerateColumns="False" |
| DataSourceID="ObjectDataSource1" |
| ShowFooter="True"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridCheckBoxColumn UniqueName="chkCol" |
| HeaderText="<center>Get<br/>Details</center>" |
| AllowFiltering="false" |
| AllowSorting="false" |
| Groupable="false"> |
| <HeaderStyle Width="40px" ForeColor="#193300" Font-Bold="true" /> |
| </telerik:GridCheckBoxColumn> |
| </Columns> |
| etc.... |
| <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2007" OnItemClick="RadMenu1_ItemClick"> |
| <Items> |
| <telerik:RadMenuItem runat="server" Text="Link Type"> |
| <Items> |
| <telerik:RadMenuItem runat="server" Text="Test" Width="150px"> |
| <ItemTemplate> |
| <asp:RadioButtonList ID="phrasepagetypeRadioButtonList" runat="server" |
| Width="150px" |
| onselectedindexchanged="phrasepagetypeRadioButtonList_SelectedIndexChanged"> |
| <asp:ListItem Value="99" Selected="True">All</asp:ListItem> |
| <asp:ListItem Value="0">Product</asp:ListItem> |
| <asp:ListItem Value="1">Inspect</asp:ListItem> |
| </asp:RadioButtonList> |
| </ItemTemplate> |
| </telerik:RadMenuItem> |
| </Items> |
| </telerik:RadMenuItem> |
protected
void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
}
protected void phrasepagetypeRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
{
}
Thanks
Matt