Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
74 views
hi and excuse me for my english i am opening a html and showing into the editor, all ok, but any images i cant see because i dont know why the editor parte any """" between the links and broke the link. For example:
http://www.casetamunicipal.com/"images/bordeprincipal.gif"
i was tryed to remove the " characters in server code but dont work. How can i remove this? whats the problem?  why the editor render this characters?

  Dim sr As New StreamReader(raizfisica, System.Text.Encoding.Default)

        'objStreamReader = File.OpenText(FILENAME)
        Dim contents As StringBuilder = New StringBuilder(sr.ReadToEnd())
        sr.Close()
          
        contents.Replace(""", "") '---- DONT WORK
       Me.RadEditor1.Content = contents.ToString
Rumen
Telerik team
 answered on 24 Feb 2010
1 answer
333 views
Hi

When i try to save my RadDateTimePicker.SelectedDate property with no date selected to the database, it returns with an error (which value should i assign to this RadDateTimePicker?):

Nullable object must have a value?

D



robertw102
Top achievements
Rank 1
 answered on 24 Feb 2010
12 answers
509 views
The splitter is working well, but there is one thing I am not sure how to do.  I am using the 100% height technique, a footer, a header, left pane, right pane.  I created a treeview in the left pane and right pane windows.  When the treeview expands out, it creates a scroll bar for both panes.  If I turn scrolling off on the pane, the treeview then is hidden behind the footer.  Is it possible for when either pane has content that expands beyond the available height that the footer gets pushed down and the browser scroll appears instead of the pane scroll.  I like how it works now that the footer sticks to the bottom of the browser window, even when you resize by using the splitters offset property, but I want the footer to get pushed down when the left, or right when the content expands.
I've seen this work using div tags, but am not sure how to do it with the rad splitter.  Below is code containing what I described above.

Thanks,

Risso

<%@ 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 id="Head1" runat="server">     
    <title>Untitled Page</title>    
    <style type="text/css">     
    html, body, form     
    {     
        height: 100%;     
        overflow: hidden;     
        margin: 0px;     
        padding: 0px;     
    }     
    </style>    
</head>    
<body>    
    <form id="form1" runat="server">   
 
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
       <div id="header" style="height:100px;background-color:Gray;">Header</div>    
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%"     
            HeightOffset="200">     
            <telerik:RadPane ID="RadPane1" runat="server" BackColor="LightBlue" Width="215" > 
                <asp:TreeView ID="TreeView1" runat="server">  
                    <Nodes> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node">  
                            <asp:TreeNode Text="New Node" Value="New Node">  
                                <asp:TreeNode Text="New Node" Value="New Node">  
                                    <asp:TreeNode Text="New Node" Value="New Node">  
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    </asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                </asp:TreeNode> 
                                <asp:TreeNode Text="New Node" Value="New Node">  
                                    <asp:TreeNode Text="New Node" Value="New Node">  
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    </asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                </asp:TreeNode> 
                                <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                            </asp:TreeNode> 
                        </asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                    </Nodes> 
                </asp:TreeView> 
            </telerik:RadPane>    
            <telerik:RadSplitBar ID="RadPaneSplitBar1" runat="server" CollapseMode="forward" /> 
            <telerik:RadPane ID="RadPane2" runat="server" BackColor="green">  
                <asp:TreeView ID="TreeView2" runat="server">  
                    <Nodes> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node">  
                            <asp:TreeNode Text="New Node" Value="New Node">  
                                <asp:TreeNode Text="New Node" Value="New Node">  
                                    <asp:TreeNode Text="New Node" Value="New Node">  
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    </asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                </asp:TreeNode> 
                                <asp:TreeNode Text="New Node" Value="New Node">  
                                    <asp:TreeNode Text="New Node" Value="New Node">  
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                    </asp:TreeNode> 
                                    <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                                </asp:TreeNode> 
                                <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                            </asp:TreeNode> 
                        </asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                        <asp:TreeNode Text="New Node" Value="New Node"></asp:TreeNode> 
                    </Nodes> 
                </asp:TreeView> 
              
            </telerik:RadPane>    
        </telerik:RadSplitter>    
        <div id="footer" style="height:100px;background-color:Gray;">Footer</div>    
    </form>    
 
</body> 
</html> 
 
AL
Top achievements
Rank 1
 answered on 24 Feb 2010
2 answers
80 views
I've gone through the thread in Asp.net editor but can't find a solution. I added createRestorePoint to my javascript function so that any pasting would occur on the last cursor location and not at the start of the radeditor and while it works fine on Mozilla, in IE8 it the pasteHTML replaces the entire content every time. My code is as below.

<input type='button' id='cmdDynEmailField' value=' >> ' onclick='SetValueInBody()' unselectable='on' /> 


function SetValueInBody() {
  var _dllGetDynamicFieldKey = $find('" + _dllGetDynamicFieldKey.ClientID + "'); 
  var _txtBody = $find('" + _txtRadEditor.ClientID + "'); 
  var _restorePoint  = _txtBody.createRestorePoint(); 
  _restorePoint.Select(); 
  _txtBody.pasteHtml(_dllGetDynamicFieldKey.get_value()); 

Please ignore the syntax of the two $find statements, the javascript is built up in a string on the server side
Rumen
Telerik team
 answered on 24 Feb 2010
3 answers
55 views
I've been using the Treeview with the verson 2009.3.9.1103 with ASP.NET MVC without any problems, but the newest version (2009.3.1314.35) the context menu fails without making a short change that is demonstracted below. Here is the area for the area occuring:
if(!$telerik.isIE||document.readyState=="complete"||document.readyState=="interactive"){this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement()); 
var b=theForm||document.body; //<--- Error here: 'theForm' is undefined
b.insertBefore(this._getContextMenuElement(),b.firstChild); 
this._detached=true
}

Complete Error:
'theForm' is undefined  Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_MainContent_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3ad0c4ca6e-6b5d-49b6-922d-5244924fb100%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.3.1314.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a603d133a-f943-435d-a80d-57457cc55f4a%3a16e4e7cd%3af7645509%3a24ee1bba%3a1e771326%3ae524c98b%3ae330518b%3ac8618e41%3ae4f8f289, line 5622 character 1

The fix is simple:
1. Add a form to the page (anywhere, doesnt require the control inside either) then give it an id;
2. Add a simple javascript script at the end of the page: var theForm = document.getElementById("form1");

The form element isnt required in this instance, so is there a new setting that i have missed to supress the error and continue presenting the context menu?

I realize the control is out of comfort zone here, but is there an alternative fix?
Dimitar Milushev
Telerik team
 answered on 24 Feb 2010
1 answer
112 views
Hello Team,

I have modified the appearance of the RadUpload control by removing the Select and remove buttons for each row (see attachment). Instead, I show file open dialog on click of the Add button. I also have added RadProgressArea and RadProgressManager controls to the form.

The issue is if I use the Out of the box functionality, the files are uploaded with the ProgressArea being shown. But if i add the script, the files are not uploaded. Below is the script i am using.


function

 

appendAttachment(sender, arguments) {

 

 

var fileDialog = sender.getFileInputs();

 

fileDialog[fileDialog.length - 1].click();

 

return true;

 

}

Please Assist
Rohit

Genady Sergeev
Telerik team
 answered on 24 Feb 2010
1 answer
103 views
Hello,

         I am using schedular in my application.
         I have kept WeekView As Default & it shows up all 24 hours duration in Schedular.

         Now what i want is, if the difference of the Appointment START & END is more than 8  Hours for a particular appointment,
         then that Appointment should be displayed at the TOP as a Whole Day Appointment.


          Please reply,


Thanks,
Kunal Patel
Peter
Telerik team
 answered on 24 Feb 2010
1 answer
81 views
It has so many examples posted to save dynamic docks to DB and retrieve from DB. I couldn't figure out why the dock state are always empty when I added multi docks once. If I only add one dock per time, it works.

My situation is that all the user controls will be added to the docks together (once)  when user first goes to Dock widget page. Then user can drag, close, drop... etc  docks.User's dock state will save to DB after user click "Save" button. Before User click save button,  I saved the dockstate to the viewstate variable.The issue is that when I retrieve dockstate from the viewstate varible on ButtonSave_Click event, the viewstate variable is always nothing.


Can any one help me out?

Pls: it is the first time for me to post the question. not sure what is the best way to post codes since It took me 10 minutes to remove the extra empty space even I used the "Format Code Block". any suggestion?

My codes:

 

 

Private ReadOnly Property CurrentDockStates() As List(Of DockState)   
 Get   
 Dim dockStatesFromDB As String   
 if Not ViewState("UserDockStatesFromDB"Is Nothing AndAlso CType(ViewState("UserDockStatesFromDB"), String) <> String.Empty Then   
     dockStatesFromDB = CType(ViewState("UserDockStatesFromDB"), String)   
 End If   
 Dim _currentDockStates As New List(Of DockState)()  
 If dockStatesFromDB <> String.Empty Then   
        Dim stringStates As String() = dockStatesFromDB.Split("|")   
        For Each stringState As String In stringStates   
                   If stringState.Trim() <> String.Empty Then   
                      _currentDockStates.Add(DockState.Deserialize(stringState))   
                   End If 
       Next   
End If   
 
Return _currentDockStates   
End Get   
End Property 
 
 
Protected Sub Page_Init(ByVal sender As ObjectByVal e As EventArgs) Handles Me.Init   
If Not Page.IsPostBack Then   
  loadData()  
  ViewState("UserDockStatesFromDB") = GetUserDockState()   
 End If   
 '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))   
      RadDockLayout1.Controls.Add(dock)  
 
     'We want to save the dock state every time a dock is moved.    
      CreateSaveStateTrigger(dock)  
      'Load the selected widget   
      LoadWidget(dock)  
End If   
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)  
End While   
End Sub   
   
 
Private Function GetUserDockState() As String      
 Dim strUserDockStatesFromDB As String      
 Dim ds As DataSet      
 Dim intViewCategotyID As Integer = -1      
 Dim dr As DataRow      
 Dim dt As DataTable      
 Dim objBS As New  BusinessServices.DockView       
objBS.SystemUserID = SystemUserID       
If Not Me.drpDockViewCategoty.SelectedItem Is Nothing Then      
  intViewCategotyID = Me.drpDockViewCategoty.SelectedValue          
End If      
       
ds = objBS.GetSystemUserDockState(intViewCategotyID)       
CommonMethods.SetFormDataSet(GS.tblSystemUserDockState, FormData)       
If Not ds.Tables(GS.tblSystemUserDockState) Is Nothing Then        
dt = ds.Tables(GS.tblSystemUserDockState)      
If Not dt.Rows Is Nothing AndAlso dt.Rows.Count > 0 Then    
With ds.Tables(GS.tblSystemUserDockState).Rows(0)   
  strUserDockStatesFromDB = .Item("DockState")      
  CurUserDockStateID = GS.Null2Zero(.Item("SystemDockStateID"))      
  CurViewCategoryID = GS.Null2Zero(.Item("DockViewCategoryID"))     
End With      
End If       
End If       
    
If strUserDockStatesFromDB = String.Empty Then       
'reload all the default control        
CreateDefaultRadDock()       
End If      
    
Return strUserDockStatesFromDB        
End Function        
    
    
    
Private Sub loadData()     
'load View Category    
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(ByVal strTitle As StringAs 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 = strTitle     
   'dock.EnableAnimation = True      
   dock.Text =String.Format("Added at {0}", DateTime.Now)      
   dock.Width = Unit.Pixel(100)     
   dock.BorderWidth = Unit.Pixel(2)     
   dock.BorderColor = Color.LightGray     
   dock.Commands.Add(New DockCloseCommand())      
      dock.Commands.Add(New DockExpandCollapseCommand())      
  dock.CommandsAutoPostBack = True      
       
Return dock      
      
End Function      
 'when user first time load Dock layout, it will load all the control to three radzone      
 Private Sub CreateDefaultRadDock()     
 Dim index As Integer      
 Dim DockList As New ArrayList()      
 Dim intCount As Integer = 0      
  Dim intReminder As Integer      
  Dim dock As RadDock      
  If Not Me.chkDockList.Items Is Nothing Then      
  intCount = Me.chkDockList.Items.Count      
  End If      
      
      
For index = 0 To intCount - 1     
dock = CreateRadDock(chkDockList.Items(index).Text)    
intReminder = index Mod 3      
 Select Case intReminder      
   Case 0      
   RadDockZone1.Controls.Add(dock)     
  Case 1      
 RadDockZone2.Controls.Add(dock)     
  Case 2      
  RadDockZone3.Controls.Add(dock)     
  End Select      
   Me.chkDockList.Items(index).Selected = True      
  'We want to save the dock state every time a dock is moved.      
  CreateSaveStateTrigger(dock)     
  'Load the selected widget      
   dock.Tag = chkDockList.Items(index).Value     
    
LoadWidget(dock)     
Next index      
  End Sub    
 
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 saveStateTrigger As New AsyncPostBackTrigger()      
    saveStateTrigger.ControlID = dock.ID     
    
saveStateTrigger.EventName = "DockPositionChanged"      
    UpdatePanel1.Triggers.Add(saveStateTrigger)     
    
saveStateTrigger = New AsyncPostBackTrigger()      
saveStateTrigger.ControlID = dock.ID     
saveStateTrigger.EventName =  "Command"      
 
    
UpdatePanel1.Triggers.Add(saveStateTrigger)     
    
 
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 RadDockLayout1_LoadDockLayout(ByVal sender As ObjectByVal e As DockLayoutEventArgs) Handles RadDockLayout1.LoadDockLayout      
 
Try      
 
    
Dim serializedList As String      
      
 If Not ViewState("UserDockStatesFromDB"Is Nothing Then      
  serializedList = ViewState(     
    
"UserDockStatesFromDB")      
      
    
      
    
    
    
End If      
      
    
    
    
      
    
If serializedList <> Nothing Then      
      
    
    
    
      
    
Dim states As String() = serializedList.Split("|"c)      
      
    
      
    
    
    
Dim i As Integer = 0      
      
    
      
    
    
    
While i < states.Length      
      
    
      
    
    
    
Dim state As DockState = DockState.Deserialize(states(i))      
      
    
e.Positions(state.UniqueName) = state.DockZoneID     
    
e.Indices(state.UniqueName) = state.Index     
    
      
    
    
    
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)      
 
End While      
 
    
End If      
   Catch ex As Exception      
 
End Try      
 End Sub    
 
Protected Sub RadDockLayout1_SaveDockLayout(ByVal sender As ObjectByVal e As DockLayoutEventArgs) Handles RadDockLayout1.SaveDockLayout      
      
 Dim stateList As List(Of DockState)=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      
     
ViewState("UserDockStatesFromDB") = dockState      
      
  End If      
End Sub      
      
      
'+-------------------------------------------------------------------------------'| Method : ButtonSave_Click      
'| Purpose : save all the state when user click Save button      
'| Returns : Boolean    
'+-------------------------------------------------------------------------------  
Protected Sub ButtonSave_Click(ByVal sender As ObjectByVal e As EventArgs) Handles btnSave.Click      
 
Dim dockState As String      
  If Not ViewState("UserDockStatesFromDB"Is Nothing Then      
    dockState = ViewState("UserDockStatesFromDB")      
End If    
    
If GetControlData(dockState) Then      
 
SaveUserDockState(FormData)     
 
End If      
 End Sub      
      
    
    
    
    
 
Private
 Function GetUserDockState() As String   
 Dim strUserDockStatesFromDB As String   
 Dim ds As DataSet   
 Dim intViewCategotyID As Integer = -1   
 Dim dr As DataRow   
 Dim dt As DataTable   
 Dim objBS As New  BusinessServices.DockView   
 
objBS.SystemUserID = SystemUserID  
 
   
 
 
 
If Not Me.drpDockViewCategoty.SelectedItem Is Nothing Then   
   
 
   
 
   
 
 
 
   
   
 
         intViewCategotyID =   
 
 
 
Me.drpDockViewCategoty.SelectedValue   
   
 
   
 
 
 
End If   
   
 
   
 
   
 
 
 
   
   
 
ds = objBS.GetSystemUserDockState(intViewCategotyID)  
 
CommonMethods.SetFormDataSet(GS.tblSystemUserDockState, FormData)  
 
   
 
 
 
If Not ds.Tables(GS.tblSystemUserDockState) Is Nothing Then   
   
 
   
 
   
 
 
 
   
   
 
dt = ds.Tables(GS.tblSystemUserDockState)  
 
   
 
 
 
If Not dt.Rows Is Nothing AndAlso dt.Rows.Count > 0 Then   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
With ds.Tables(GS.tblSystemUserDockState).Rows(0)   
   
 
      strUserDockStatesFromDB = .Item(  
 
 
 
"DockState")   
   
 
      CurUserDockStateID = GS.Null2Zero(.Item(  
 
 
 
"SystemDockStateID"))   
   
 
      CurViewCategoryID = GS.Null2Zero(.Item(  
 
 
 
"DockViewCategoryID"))   
   
 
   
 
 
 
End With   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
End If   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
End If   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
If strUserDockStatesFromDB = String.Empty Then   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
'reload all the default control   
   
 
   
 
   
 
 
 
   
   
 
CreateDefaultRadDock()  
 
   
 
 
 
End If   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Return strUserDockStatesFromDB   
   
 
   
 
 
 
End Function   
   
 
   
 
   
 
 
 
 
   
   
 
   
 
 
 
Private Sub loadData()   
   
 
   
 
 
 
'load View Category   
   
 
   
 
   
 
 
 
   
   
 
   
 
   
 
 
 
   
   
 
 
 
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(ByVal strTitle As StringAs 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 = strTitle  
 
   
 
 
 
'dock.EnableAnimation = True   
   
 
   
 
   
 
 
 
   
   
 
dock.Text =   
 
 
 
String.Format("Added at {0}", DateTime.Now)   
   
 
dock.Width = Unit.Pixel(100)  
 
dock.BorderWidth = Unit.Pixel(2)  
 
dock.BorderColor = Color.LightGray  
 
dock.Commands.Add(  
 
 
 
New DockCloseCommand())   
   
 
dock.Commands.Add(  
 
 
 
New DockExpandCollapseCommand())   
   
 
   
 
 
 
dock.CommandsAutoPostBack = True   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Return dock   
   
 
   
 
 
 
End Function   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
'when user first time load Dock layout, it will load all the control to three radzone   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Private Sub CreateDefaultRadDock()  
 
   
 
   
 
 
 
 
Dim index As Integer   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Dim DockList As New ArrayList()   
   
 
   
 
 
 
Dim intCount As Integer = 0   
   
 
   
 
 
 
Dim intReminder As Integer   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Dim dock As RadDock   
   
 
   
 
 
 
If Not Me.chkDockList.Items Is Nothing Then   
   
 
   
 
   
 
 
 
   
   
 
intCount =   
 
 
 
Me.chkDockList.Items.Count   
   
 
   
 
 
 
End If   
   
 
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
For index = 0 To intCount - 1   
   
 
dock = CreateRadDock(chkDockList.Items(index).Text)  
 
intReminder = index   
 
 
 
Mod 3   
   
 
   
 
 
 
Select Case intReminder   
   
 
   
 
 
 
Case 0   
   
 
RadDockZone1.Controls.Add(dock)  
 
   
 
 
 
Case 1   
   
 
RadDockZone2.Controls.Add(dock)  
 
   
 
 
 
Case 2   
   
 
RadDockZone3.Controls.Add(dock)  
 
   
 
 
 
End Select   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
Me.chkDockList.Items(index).Selected = True   
   
 
   
 
   
 
 
 
   
   
 
   
 
 
 
'We want to save the dock state every time a dock is moved.   
   
 
   
 
   
 
 
 
   
   
 
CreateSaveStateTrigger(dock)  
 
   
 
 
 
'Load the selected widget   
   
 
   
 
   
 
 
 
   
   
 
dock.Tag = chkDockList.Items(index).Value  
 
LoadWidget(dock)  
 
   
 
 
 
Next index   
   
 
   
 
 
 
End Sub 
 
 
   
   
 
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 saveStateTrigger As New AsyncPostBackTrigger()   
   
 
saveStateTrigger.ControlID = dock.ID  
 
saveStateTrigger.EventName =   
 
 
 
"DockPositionChanged"   
   
 
   
 
   
 
 
 
   
   
 
UpdatePanel1.Triggers.Add(saveStateTrigger)  
 
saveStateTrigger =   
 
 
 
New AsyncPostBackTrigger()   
   
 
saveStateTrigger.ControlID = dock.ID  
 
saveStateTrigger.EventName =   
 
 
 
"Command"   
   
 
   
 
   
 
 
 
   
   
 
UpdatePanel1.Triggers.Add(saveStateTrigger)  
 
   
 
 
 
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 RadDockLayout1_LoadDockLayout(ByVal sender As ObjectByVal e As DockLayoutEventArgs) Handles RadDockLayout1.LoadDockLayout   
   
 
   
 
 
 
Try   
   
 
 
 
   
 
Dim serializedList As String   
   
 
 
 
   
 
If Not ViewState("UserDockStatesFromDB"Is Nothing Then   
   
 
 
 
serializedList = ViewState(  
 
"UserDockStatesFromDB")   
   
 
   
 
 
 
End If   
   
 
 
 
   
 
If serializedList <> Nothing Then   
   
 
 
 
   
 
Dim states As String() = serializedList.Split("|"c)   
   
 
   
 
 
 
Dim i As Integer = 0   
   
 
   
 
 
 
While i < states.Length   
   
 
   
 
 
 
Dim state As DockState = DockState.Deserialize(states(i))   
   
 
e.Positions(state.UniqueName) = state.DockZoneID  
 
e.Indices(state.UniqueName) = state.Index  
 
   
 
 
 
System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)   
   
 
   
 
 
 
End While   
   
 
 
 
   
 
End If   
   
 
 
 
   
 
Catch ex As Exception   
   
 
   
 
 
 
End Try   
   
 
 
 
   
 
End Sub 
 
 
 
   
 
 
 
   
 
Protected Sub RadDockLayout1_SaveDockLayout(ByVal sender As ObjectByVal e As DockLayoutEventArgs) Handles RadDockLayout1.SaveDockLayout   
   
 
   
 
 
 
Dim stateList As List(Of DockState) = 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   
   
 
 
 
ViewState(  
 
"UserDockStatesFromDB") = dockState   
   
 
   
 
 
 
End If   
   
 
 
 
   
 
End Sub   
   
 
   
 
 
 
   
 
'+---------------------------------------------------------------------------------------------   
   
 
 
 
   
 
'| Method : ButtonSave_Click   
   
 
 
 
   
 
'| Purpose : save all the state when user click Save button   
   
 
 
 
   
 
'| Returns : Boolean   
   
 
 
 
   
 
'+---------------------------------------------------------------------------------------------   
   
 
 
 
   
 
Protected Sub ButtonSave_Click(ByVal sender As ObjectByVal e As EventArgs) Handles btnSave.Click   
   
 
   
 
 
 
Dim dockState As String   
   
 
 
 
   
 
If Not ViewState("UserDockStatesFromDB"Is Nothing Then   
   
 
 
 
dockState = ViewState(  
 
"UserDockStatesFromDB")   
   
 
   
 
 
 
End If 
 
If GetControlData(dockState) Then   
   
 
 
 
SaveUserDockState(FormData)  
 
   
 
End If   
   
 
 
 
   
 
End Sub   
   
 
 
 
 
 
 

Pero
Telerik team
 answered on 24 Feb 2010
1 answer
101 views
Hello,

         I am using Rad Scheduler to display meeting details.
         Now, I enter the meeting details by selecting the date from RadDatePickter & Time from Time Picker.
           also, i enter the title for the meeting in Text Box.

         Now the issue is that, if for e.g. i select DATE : 02/19/2010 & TIME : 12:00 AM,
             the the value entered in the database will be 2010-02-19 00:00:00.000
                                                                   [ I am using SQL SERVER 2005 Database with this field as Date Time]
          Now when i bind the Scheduler with all the records from the database,
               the records which are having TIME : 12:00 AM are not bound to Scheduler.

           And one more thing, If i change the Scheduler View to MONTH, then all the records are bound.
           so, it does not work with Day & Week View as they both have TIME specification.

         Please reply me as soon as possible, as i am having too much issues regarding this,


Thanks,
Kunal Patel
      
        



           
     

Peter
Telerik team
 answered on 24 Feb 2010
5 answers
106 views
Hi,

I'm trying to set the pager radcombobox in my grid to populate itself with values from my web.config file.  This is working, except that the following is happening: when I change my number of items to show on one page from 10 to 2 (for testing; I only have 7 items in the grid) two items show up, but when I try to navigate through the grid, it resets itself to 10 and I get an empty grid, (i.e., if I click the next button it thinks it's on page 2 but it also thinks that there's only one page there, so it shows nothing).  When I click back to page 1, it shows all my records.  Here's the code:

ASPX:
    <telerik:RadGrid ID="rgUsers" runat="server" 
        OnNeedDataSource="rgUsers_NeedDataSource" OnItemCreated="rgAdminUsers_ItemCreated">  
        <MasterTableView DataKeyNames="UserName">  
            <Columns> 
                <telerik:GridCheckBoxColumn DataField="IsOnline" DataType="System.Boolean" 
                    HeaderText="Is Online?" UniqueName="IsOnline" > 
                </telerik:GridCheckBoxColumn> 
                <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName">  
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="LastLoginDate" HeaderText="Last Logged In" UniqueName="column">  
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn HeaderText="Is Approved?" UniqueName="IsApproved" SortExpression="IsApproved" DataField="IsApproved">  
                    <ItemTemplate> 
                        <asp:CheckBox ID="cbIsApproved" runat="server" AutoPostBack="true" Checked='<%# Bind("IsApproved") %>'   
                            OnCheckedChanged="gvUsers_UpdateIsApproved"  /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn HeaderText="Is Locked Out?" UniqueName="IsLockedOut" SortExpression="IsLockedOut" DataField="IsLockedOut">  
                    <ItemTemplate> 
                        <asp:CheckBox ID="cbIsLockedOut" runat="server" AutoPostBack="true" Checked='<%# Bind("IsLockedOut") %>'   
                            OnCheckedChanged="gvUsers_UpdateLockedOut" Enabled='<%# Bind("IsLockedOut") %>' /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn HeaderText="Role(s)" UniqueName="Roles" DataField="Roles" AllowFiltering="False">  
                    <ItemTemplate> 
                        <%# String.Join(", ",Roles.GetRolesForUser(DataBinder.Eval(Container.DataItem, "UserName").ToString())) %> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn HeaderText="Petition(s)" UniqueName="Petitions" DataField="Petitions" AllowFiltering="False">  
                    <ItemTemplate> 
                        <%# new ProfileCommon().GetProfile(DataBinder.Eval(Container.DataItem, "UserName").ToString()).Petitions.Replace(", ","<br />") %> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn UniqueName="TemplateColumn" AllowFiltering="False">  
                    <ItemTemplate> 
                        <asp:Button ID="btnEditRoles" runat="server" CausesValidation="false" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "UserName").ToString() %>' 
                            CommandName="EditRoles" Text="Edit Roles" OnClick="EditRoles" /> 
                        <asp:Button ID="btnEditPetitions" runat="server" CausesValidation="false" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "UserName").ToString() %>' 
                            CommandName="EditRoles" Text="Edit Petitions" OnClick="EditPetitions" /> 
                        <asp:Button ID="btnChangePassword" runat="server" CausesValidation="false" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "UserName").ToString() %>' 
                            CommandName="ChangePassword" Text="Change Password" OnClick="ChangePassword" /> 
                        <asp:Button ID="btnUserInfo" runat="server" CausesValidation="false" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "UserName").ToString() %>' 
                            CommandName="ViewUserInfo" Text="View User Info" OnClick="ViewUserInfo" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
 

CS:
    protected void rgAdminUsers_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)  
    {  
        // Pull Number of Entries per page in page from web.config appsettings.  
        if (e.Item is GridPagerItem)  
        {  
            RadComboBox myPageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");  
            myPageSizeCombo.Items.Clear();  
            string strPageSizes = ConfigurationManager.AppSettings["PageSizes"];  
            string[] arrPageSizes = strPageSizes.Split(',');  
            for (int x = 0; x < arrPageSizes.Length; x++)  
            {  
                RadComboBoxItem myRadComboBoxItem = new RadComboBoxItem(arrPageSizes[x]);  
                myPageSizeCombo.Items.Add(myRadComboBoxItem);  
                myPageSizeCombo.FindItemByText(arrPageSizes[x]).Attributes.Add("ownerTableViewId", rgUsers.MasterTableView.ClientID);   
            }  
            myPageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;  
        }  
    }  
 
Laurie
Top achievements
Rank 2
 answered on 24 Feb 2010
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?