Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
152 views
I am using the following code straight from the demo.
If I can get this working I can modify to suit me needs from there.
When I add a dock it simply replaces the existing dock.
I'm assuming that there is some code that is not on the demo page that I need to make this work.


Partial

 

Public Class DynamicControlTest

 

 

Inherits System.Web.UI.Page

 

 

Private Property CurrentDockStates() As List(Of DockState)

 

 

Get

 

 

Dim _currentDockStates As List(Of DockState) = DirectCast(Session("CurrentDockStatesDynamicDocks"), List(Of DockState))

 

 

If [Object].Equals(_currentDockStates, Nothing) Then

 

_currentDockStates =

New List(Of DockState)()

 

Session(

"CurrentDockStatesDynamicDocks") = _currentDockStates

 

 

End If

 

 

Return _currentDockStates

 

 

End Get

 

 

Set(ByVal value As List(Of DockState))

 

Session(

"CurrentDockStatesDynamicDocks") = value

 

 

End Set

 

 

End Property

 

 


Dim
save As Boolean = False

 

 

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.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 =

"Dock"

 

dock.Text =

String.Format("Added at {0}", DateTime.Now)

 

dock.Width = Unit.Pixel(300)

dock.Commands.Add(

New DockCloseCommand())

 

dock.Commands.Add(

New DockExpandCollapseCommand())

 

 

Return dock

 

 

End Function

 

 


Private
Sub CreateSaveStateTrigger(ByVal dock As RadDock)

 

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

 

 


Protected
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)

 

 

Dim i As Integer = 0

 

 

While i < CurrentDockStates.Count

 

 

Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i))

 

RadDockLayout1.Controls.Add(dock)

CreateSaveStateTrigger(dock)

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)

 

 

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)

 

 

If save = True Then

 

CurrentDockStates = RadDockLayout1.GetRegisteredDocksState()

save =

False

 

 

End If

 

 

End Sub

 

 


Protected
Sub ButtonAddDock_Click(ByVal sender As Object, ByVal e As EventArgs)

 

 

Dim dock As RadDock = CreateRadDock()

 

RadDockZone1.Controls.Add(dock)

CreateSaveStateTrigger(dock)

save =

True

 

 

End Sub

 

End

 

Class

 



Help me understand what I'm missing.  Markup is identical to the one given in Telerik Example.
cbospikes
Top achievements
Rank 1
 answered on 05 Jun 2009
2 answers
128 views
I have 2 Rad Dock controls on my page. I have a button inside Dock1 that on click I am collapsing Dock1 and expanding Dock2. I added the Rad AJAX Manager to the page to Ajaxify this scenario. When I set the AJAX Manager to update Dock1 and Dock2 with the button as the source, I get an error:


Telerik.Web.UI.RadDockZone can contain only controls of type Telerik.Web.UI.RadDock

The AJAX Manager is not inside the DockZone.... What am I missing here? Thanks.

Joe
Top achievements
Rank 1
 answered on 05 Jun 2009
1 answer
155 views
I have an application that uses a formview within the Grid's NestedViewTemplate to display additional record data:
<telerik:RadGrid ID="grid_applications" runat="server"  
.... 
<NestedViewTemplate> 
    <asp:Label ID="GridRec" runat="server" Visible="false" Text='<%# Eval("record") %>' /> 
       <uc1:AppViewer ID="AppViewer1" runat="server" /> 
    </NestedViewTemplate> 

Inside the UserControl I have a FormView to display all the additional data.  All of this works fine.

However, I have a RadComboBox that I use to perform an update of status when the user selects something.  This column is found on the main grid so when they make a change I want the main grid to display the new value immediately, I cant get it to work.  I thought I could just rebind the main grid like so:
Protected Sub list_appState_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) 
 
        Dim record As Integer = (TryCast(Parent.FindControl("GridRec"), Label)).Text 
        Dim AppState As String = (TryCast(formview_AppInfo.FindControl("list_appState"), RadComboBox)).SelectedValue 
 
        Dim UpdateSuccess As Integer = Apps.UpdateAppState(record, AppState) 
 
        If UpdateSuccess > 0 Then 
            lbl_status.Text = String.Format("<br />The Application Status has been updated to '{0}' for record: {1}.<br /><br />", AppState, record) 
            Dim grid As RadGrid = (TryCast(Parent.FindControl("grid_applications"), RadGrid)) 
            grid.Rebind() 
        Else 
 
        End If 
 
    End Sub 

However on that rebind I get the error:

Object reference not set to an instance of an object.


Should I not be able to reference the grid just as I do other controls on the parent and then rebind it?


Tsvetoslav
Telerik team
 answered on 05 Jun 2009
6 answers
372 views
Hi,

I've really struggled with this for a couple of days now and have tried several approaches.  I'm trying to use a toolbar button to add a record to my sql database and then refresh the data shown in my RadGrid to display the new record and then open a RadWindow to edit the new record.

I've got a toolbar button that when clicked runs the following jscript :-
switch (button.get_value()) {  
    case "AddInstance":  
        var treeview = $find("<%=RadTreeView1.ClientID %>");  
        var treeNode = treeview.get_selectedNode();  
        if (treeNode == null) {  
            alert("Select an application first");  
            break;  
            };  
        var application_id = treeNode.get_value();  
        var arguements = "AddInstance," + application_id;  
        RadAjaxManager1.ajaxRequest(arguements);  
        break;  

This calls the server-side code which successfully creates the sql record :-

Protected

Sub RadAjaxManager1_OnAjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)

 

Dim splitArguements As Array = Split(e.Argument, ",")  
Dim strFunction As String = splitArguements(0)  
Dim intIndex As Integer = splitArguements(1)  
 
Select Case strFunction  
    Case "AddInstance" 
        Dim hidden_idx As HtmlInputHidden = FindControl("hidden_idx")  
 
        SqlDataSource2.InsertParameters("instance_name").DefaultValue = "New Instance - " & CStr(Now)  
        SqlDataSource2.InsertParameters("application_id").DefaultValue = intIndex  
        SqlDataSource2.InsertParameters("testing_environment_id").DefaultValue = 1  
        SqlDataSource2.Insert()  
 
        hidden_idx.Value = CStr(NewInstanceId)  
        RadGrid1.Rebind()  
        MsgBox(hidden_idx.Value)  
 
End Select 

End Sub
 
Private Sub SqlDataSource2_Inserted(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource2.Inserted  
 
    NewInstanceId = e.Command.Parameters("@instance_id").Value.ToString  
 
End Sub 
 
 
 

The above code works and the RadGrid1 is refreshed by my RadAjaxManager showing the new record.  The hidden inputs value is set and the messagebox appears with the correct index of the new record.

The next bit of code is where I'm struggling.  Although the code behind has set the value of the Hidden_idx control  I just can't ssem to find this control with the client side code.  I just keep getting null  :-
<body style="border:50px;">  
     
    <form id="form1" runat="server">  
      
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
    <script type="text/javascript">  
 
    function RadAjaxManager1_OnResponseEnd(sender, args) {  
 
        var hidden_input = $find("<%=Hidden_idx.ClientID %>");  
        alert(hidden_input);  
        var idx = hidden_input.value  
        alert(idx);  
          
        window.radopen("InstanceDetails.aspx?instance_id=" + instance_id, "RadWindow1");  
 
    }  
 
   </script> 
   </telerik:RadCodeBlock> 
 
   <input type="hidden" id="Hidden_idx" name="Hidden_idx" runat="server" /> 
 

Can you spot where I'm going wrong?  Is there a better way of doing this?  I've tried setting the innerhtml of a div which I could find with getElementByID but the innerhtml was always empty when read client-side even though the server side had set and read the value.

Thanks in advance for any help with this.
Jase

Jason
Top achievements
Rank 2
 answered on 05 Jun 2009
2 answers
156 views
Hi, I have a problem with the Tooltipified RadGrid and vb.net, i have made the conversion from sample #c to vb, it works but the tooltips work only the first time displaying the same record on all next row then selected the link Show Tooltip in the column grid
It possible have an sample in vb.net ?
Tnks

Ps) Excuse my English, I speak little

Hi from Italy and congratulations from Telerik Components...

Aurelio.

Aurelio Righetti
Top achievements
Rank 1
 answered on 05 Jun 2009
6 answers
124 views
Is there a way to build the listview for the grid all on the client side. Please send sample. Thank you
Sebastian
Telerik team
 answered on 05 Jun 2009
2 answers
128 views
I have a Rad Editor which uses an Image Manager and Template Manager. I have copied the Editor Dialogs folder to my app so I can custoimze the dialogs. I need to disallow users from making any modifications to the file structure (uploading/creating folders, renaming, etc.) in the template manager, but they can do all of that in the Image manager. It seems that both managers use the FileBrowser UserControl. I can make the changes in FilBrowser.ascx, but I obviously don't want them to be applied to both managers. How do I customiized the FIle Browser for one manager or the other.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 05 Jun 2009
1 answer
111 views
i have agrid that i am binding through client side binding

and on the rowdatabound clientevent im replacing the rows innerhtml and my width of the grid goes to a rexolution of about 900px and the innerhtml that i am replacing the width is about 290px each  . So each row should float to be 3 rows to one row. This works great in all other browsers except ie 7 and below.

Please help fix this last issue. I need to keep this on the client side binding because we switch views which works very well except in ie7 and below and i need them to work here as well.

Thank you
Tammy ODonnell

.RadGrid_Default

 

.rgRow,

 

.RadGrid_Default

 

.rgAltRow

 

{

 

padding-left:1px;

 

 

padding-right:1px;

 

 

font-size:11px;

 

 

cursor:default;

 

 

float:left;

 

 

display:block;

 

 

}



 

function ArchiveProjectGrid_RowDataBound(sender, args)

 

{

 

 

    switch(MainTabSelected)

 

    {

 

        case Enum.MainTab.Archive:

 

 

       args.get_item()._element.cells[0].innerHTML = ArchiveGridAltTemplate(sender,args).toString();

 

 

 

 

 

         break;

 

 

    }
}

 

 

 

function

 

ArchiveGridAltTemplate(sender,args)

 

{

 

var DataItem = args.get_dataItem();

 

 

var sb = new Sys.StringBuilder();

 

 

var panel = ReturnPanelFilter();

 

 

var items = panel.get_items();

 

 

var panelbar = ReturnPanelFilter();

 

 

var panelItem;

 

 

var panelItemAdd;

 

 

var panelToAddTo;

 

 

var strOne = DataItem["ProjectNo"] + "," + DataItem["ProjectLeader"]+ "," +DataItem["Client"]+ "," +DataItem["Study"]+ "," +DataItem["StartTime"]+ "," +DataItem["EndTime"]+ "," +DataItem["Dept"];

 

 

var rowIndex;

 

 

try{rowIndex = args.get_item()._element.rowIndex.toString()}

 

 

catch(sError) { rowIndex = args._element.rowIndex.toString()}

 

 

 

var myDate = DataItem["Date"];

 

 

 

var dt = new Date(myDate);

 

 

var newDate = dt.format("m/dd/yyyy");

 

 

var y=dt.getYear();

 

 

var m=dt.getMonth() + 1;

 

 

var day=dt.getDate();

 

newDate=m+

"/"+day+"/"+y ;

 

 

 

 

 

// var tempIndex = rowIndex;

// if(tempIndex >=18) {tempIndex = tempIndex - 18;}

// if(tempIndex != 0)

 

 

 

 

sb.appendLine(

"</td></tr></table>");

 

 

 

//class='GridRow' style=' height:150px;

 

 

 

 

 

 

sb.appendLine(

"<div style='width:290px;margin-top:0; height:150px; display:block;max-height:150px; position:relative; padding: 3px 5px 15px 8px;'>");

 

sb.appendLine(

"<div class='ThumbnilColumnExtLrg' style='float:left;margin-top:0;'>");

 

sb.appendLine(String.format(

"<img onload=\"RetrievePictureMedia(this,'{2}','s');\" title='{0}' ondblclick=\"SelectRowClickLaunch('{3}');\" onclick=\"SelectRowClick('{3}');\" alt='{1}' src=\"Images/EmptyMedia.jpg\" ></img>" , DataItem["ProjectNo"], DataItem["ProjectNo"], DataItem["ProjectNo"],rowIndex));

 

sb.appendLine(

"</div>");

 

sb.appendLine(

"<div class='AltTemplateItemCol' >");

 

sb.appendLine(

"<b>Project: </b>");

 

sb.appendLine(String.format(

"{0}&nbsp;<b><a style='color:red; cursor:pointer; font-size:8px;' onclick='LoadProjectITEMS({1})'>Details </a></b>",DataItem["ProjectNo"],rowIndex));

 

 

// sb.appendLine(String.format("{0}",DataItem["ProjectNo"]));

 

 

 

 

 

sb.appendLine(

"</div>");

 

sb.appendLine(

"<div class='AltTemplateItemCol' >");

 

sb.appendLine(

"<b>Date: </b>");

 

sb.appendLine(String.format(

"{0}",newDate));

 

sb.appendLine(

"</div>");

 

sb.appendLine(

"<div class='AltTemplateItemCol' >");

 

sb.appendLine(

"<b>Project Leader: </b>");

 

sb.appendLine(String.format(

"{0}",DataItem["ProjectLeader"]));

 

sb.appendLine(

"</div>");

 

sb.appendLine(

"<div class='AltTemplateItemCol' >");

 

sb.appendLine(

"<b>Expires in Days: </b>");

 

sb.appendLine(String.format(

"{0}",DataItem["ExpiresinDays"]));

 

sb.appendLine(

"</div>");

 

sb.appendLine(

"<div class='AltTemplateItemCol'>");

 

sb.appendLine(

"<b>City: </b>");

 

sb.appendLine(String.format(

"{0}",DataItem["City"]));

 

sb.appendLine(

"</div>");

 

 

 

 

 

sb.appendLine(

"</div>");

 

 

 

 

 

// if(tempIndex != (18 - 1))

 

 

 

 

sb.appendLine(

"</td><table style='display:none;'><tr><td>");

 

 

return sb;

 

}



I need to have the

 

<telerik:RadGrid ID="ArchiveProjectGrid" runat="server" EnableEmbeddedSkins="false"

 

 

EnableViewState="false" GridLines="None" ShowHeader="false" AllowPaging="true"

 

 

AllowCustomPaging="true" ShowFooter="true" AllowMultiRowSelection="false" Width="100%"

 

 

AutoGenerateColumns="false" ShowStatusBar="false" PageSize="3" Height="100%"

 

 

VirtualItemCount="500">

 

 

<StatusBarSettings ReadyText="" LoadingText="Please wait while processing your request" />

 

 

<MasterTableView ShowFooter="false" AllowFilteringByColumn="true" TableLayout="Fixed"

 

 

ClientDataKeyNames="ProjectNo,ItemID,ProjectLeader,Date,Facility,City,Study,ProjectTopic,Product,Dept,ExpiresinDays,ResearchVendor,Moderator,Name">

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="ProjectNo" HeaderText="ProjectNo" Visible="true">

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

<RowIndicatorColumn Visible="False" Display="false">

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn Visible="False" Resizable="False">

 

 

</ExpandCollapseColumn>

 

 

<EditFormSettings>

 

 

<PopUpSettings ScrollBars="None"></PopUpSettings>

 

 

</EditFormSettings>

 

 

<HeaderStyle Wrap="False"></HeaderStyle>

 

 

</MasterTableView>

 

 

<FilterMenu BorderColor="Black">

 

 

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

 

 

</FilterMenu>

 

 

<PagerStyle Mode="NumericPages"></PagerStyle>

 

 

<SortingSettings SortedBackColor="Transparent" />

 

 

<ClientSettings AllowColumnsReorder="false" ReorderColumnsOnClient="false" AllowGroupExpandCollapse="false">

 

 

<Selecting AllowRowSelect="true" EnableDragToSelectRows="true" />

 

 

<Scrolling EnableVirtualScrollPaging="false" SaveScrollPosition="False" AllowScroll="true"

 

 

UseStaticHeaders="true" />

 

 

<ClientEvents OnRowDblClick="ArchiveProjectGrid_OnRowDblClick" OnRowSelected="ArchiveProjectGrid_OnRowClick"

 

 

OnDataBound="ArchiveProjectGrid_DataBound" OnGridCreated="ArchiveProjectGrid_Created"

 

 

OnCommand="ArchiveProjectGrid_Command" OnRowDataBound="ArchiveProjectGrid_RowDataBound" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

Sebastian
Telerik team
 answered on 05 Jun 2009
3 answers
201 views
Hi
I have been examing the requests between IE7 and one of our servers (IIS6)

I note that there is request rejected due to authorization failure (401.2)

This is in part due to IIS being configure to use NTLM only which is as it has to be.

By allowing anonymous access to some of the static content I can remove the failure for those requests.

However,  may of the resources are embedded.

Is it possible to set anonymous permissions on these embedded resources?

Or is there a global solution?

Cheers
Martin

Atanas Korchev
Telerik team
 answered on 05 Jun 2009
4 answers
140 views

i am getting this error The Controls collection cannot be modified because the control contains code blocks

i dont know what it means this is the code that i have changed to cause it

 

<

 

telerik:AjaxSetting AjaxControlID="RadMenu1">  

 

 

 

    <UpdatedControls>

         

 

<telerik:AjaxUpdatedControl ControlID="RadMenu1" />
    
</UpdatedControls>
</telerik:AjaxSetting>

 

 

 

 

 



also the control isnt rendering properly and i have the lastest set of controls i dont know why this is happening
Kevin
Top achievements
Rank 1
 answered on 05 Jun 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
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
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?