Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
69 views

Hi

Question about JsonSerialization.
I saw that for the RadTreeVieNode API: node.set_checked(...); the code is:

set_checked:function(_b4,e){
 
this._check(_b4,e);
if(this.get_treeView()){
this.get_treeView()._updateCheckedState();
}
}

 
_updateCheckedState:function(){
this._checkedNodesJson=Sys.Serialization.JavaScriptSerializer.serialize(this._clientState.checkedNodes); // line XXX
this.updateClientState();
}

Now profiling the loop

var cnt = treeNodes.get_count();
for(var i = 0; i < cnt; i++) {
var node = treeNodes.getNode(i);
if (node.get_checked() != checkOrUncheck) {
node.set_checked(checkOrUncheck);
}

I see that > 95% of time we sit in _serializeWithBuilder(...) function. It's called from the line XXX.
Now, I do not need to have this. Since all the operations with RadTreeView i do on client side using client API.
There should be a possibility to disable Jsonization of nodes in the RadTree so I ll get much more performant API.

Pls assist.

Thx
Gani

Gani
Top achievements
Rank 1
 asked on 13 Apr 2010
4 answers
196 views
Hello, I have a challenge invloving a grid that is nested underneath a panelbal that is, in turn inside a multiview.  I am using the PopUp Edit functionality with the Edit Template nested inside the MasterTableView. 

To access the Edit Form from this grid, I am using the AutoGenerated edit button.  Upon clicking the button, after the AjaxLoadpanel fires and the page is re-rendered the Edit Template appears as a Modal PopUp, as required.

The challenge comes in the ItemCommand event handler for the grid, after making a change in the Edit form, and clicking the button that I have designated for Updating the necessary objects and sending off to the database.  I am not using a SqlDataSource. I am running the MVP architecture (not MS MVC) and all of the necessary postback actions happen as required. 

Here is the page with the necessary parts:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%" Height="100%" 
        ResizeMode="EndPane" Skin="Default" Font-Size="Large" BorderStyle="None">  
        <telerik:RadSplitBar ID="RadSplitBar2" runat="server"  CollapseMode="Forward" /> 
        <telerik:RadPane ID="rdpFollowData" runat="server" Scrolling="Y" Height="590px">  
               <telerik:RadTabStrip ID="tbFollowData" runat="server" 
                MultiPageID="rdmultFollowup" SelectedIndex="0"   
                Width="100%" AutoPostBack="False" > 
                <tabs> 
                    <telerik:RadTab PageViewID="rpvSeller" Text="Seller Details">  
                    </telerik:RadTab> 
                </tabs> 
            </telerik:RadTabStrip> 
            <telerik:RadMultiPage ID="rdmultFollowup" runat="server" SelectedIndex="0" Width="100%">  
                  <telerik:RadPageView ID="rpvSeller" runat="server">  
                    <telerik:RadPanelBar ID="rpbSeller" runat="server" Skin="Default"   
                        Style="float:left" Width="100%">  
                        <Items> 
                            <telerik:RadPanelItem ImagePosition="Right" Text="General">  
                                <Items> 
                                    <telerik:RadPanelItem Value="General" runat="server">  
                                        <ItemTemplate> 
                                            <asp:Button ID="btnAddOwner" runat="server" Text="Add Seller" /><br /> 
                                            <telerik:RadGrid ID="rgSeller" runat="server" AutoGenerateColumns="False" AutoGenerateEditColumn="true" GridLines="None" OnDataBound="rgSeller_DataBound" OnItemDataBound="rgSeller_ItemDataBound" OnNeedDataSource="rgSeller_NeedDataSource" OnItemCommand="rgSeller_ItemCommand" EditItemStyle-Width="300px">  
                                                <ClientSettings> 
                                                    <ClientEvents OnRowDblClick="RowDblClick" /> 
                                                </ClientSettings> 
                                                <MasterTableView Height="100%" Width="50%" EditMode="PopUp" > 
                                                    <EditFormSettings CaptionFormatString="Edit User: {0}" CaptionDataField="UserID" EditFormType="Template" PopUpSettings-Modal="true">  
                                                        <FormTemplate> 
                                                            <table id="editForm" width="400px">  
                                                                <tr> 
                                                                    <td align="left">  
                                                                        First Name:&nbsp;&nbsp;<asp:TextBox ID="txtFirstname" runat="server" Text='<%# Bind("FirstName") %>'></asp:TextBox> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td align="left">  
                                                                        Last Name :&nbsp;&nbsp;<asp:TextBox ID="txtLastname" runat="server" Text='<%# Bind("LastName") %>'></asp:TextBox> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td align="left" colspan="3">  
                                                                        Mailing Address :&nbsp;&nbsp;<asp:TextBox ID="txtAddress" Width="250px" runat="server" 
                                                                            Text='<%# Bind("MailAddress") %>' />,  
                                                                        <asp:TextBox ID="txtCity" Width="250px" runat="server" Text='<%# Bind("MailCity") %>' />,  
                                                                        <asp:TextBox ID="txtState" Width="25px" runat="server" Text='<%# Bind("MailState") %>' />,  
                                                                        <asp:TextBox ID="txtZip" Width="50px" runat="server" Text='<%# Bind("MailZip") %>' /> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td align="left">  
                                                                        <telerik:RadGrid ID="rgPhones" runat="server" Skin="Default" > 
                                                                            <MasterTableView GridLines="Horizontal" Frame="Void" NoMasterRecordsText="No Phone Numbers Listed" 
                                                                                AutoGenerateColumns="false" Width="100%">  
                                                                                <Columns> 
                                                                                    <telerik:GridBoundColumn DataField="PhoneID" Visible="false" /> 
                                                                                    <%--<telerik:GridButtonColumn ButtonType="LinkButton" Text="Delete" />--%> 
                                                                                    <telerik:GridBoundColumn HeaderText="Phone Number" DataField="Phone" /> 
                                                                                </Columns> 
                                                                            </MasterTableView> 
                                                                        </telerik:RadGrid> 
                                                                        <asp:Button ID="btnAddUserPhone" runat="server" Text="Add Phone" /> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td align="left">  
                                                                        Username :&nbsp;&nbsp;<asp:TextBox ID="txtUsername" runat="server" Text='<%# Bind("UserName")%>'></asp:TextBox> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td colspan="3" align="left">  
                                                                        Email :&nbsp;&nbsp;<asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox> 
                                                                    </td> 
                                                                </tr> 
                                                                <tr> 
                                                                    <td colspan="3" align="right">  
                                                                        <asp:Button ID="btnResetPassword" runat="server" Text="Reset Password" CommandName="ResetPassword" /> 
                                                                        <asp:Button ID="btnUpdateUser" runat="server" Text="Update" CommandName="UpdateUser"/>  
                                                                        <asp:Button ID="btnCanc" runat="server" Text="Cancel" CommandName="Cancel"/>  
                                                                    </td> 
                                                                </tr> 
                                                            </table> 
                                                        </FormTemplate> 
                                                    </EditFormSettings> 
                                                    <Columns> 
                                                        <telerik:GridBoundColumn DataField="UserID" Visible="false"/>  
                                                        <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" EditFormColumnIndex="0"/>  
                                                        <telerik:GridBoundColumn DataField="LastName" HeaderText="FirstName" EditFormColumnIndex="0"/>  
                                                    </Columns> 
                                                </MasterTableView> 
                                            </telerik:RadGrid> 
                   </ItemTemplate> 
                                      
                                    </telerik:RadPanelItem> 
                                </Items> 
                              
                            </telerik:RadPanelItem> 
</Items> 
              
                    </telerik:RadPanelBar> 
                </telerik:RadPageView> 
        </telerik:RadPane> 
    </telerik:RadSplitter> 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
 
        <script type="text/javascript">  
            function RowDblClick(sender, eventArgs) {  
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());  
            }  
        </script> 
 
    </telerik:RadCodeBlock> 
</asp:Content>    
My apologies for the alignment, and missing tags :/

Here is the code to populate the grid:
private void ShowSellerData(List<Users> sellers, List<PhoneNumbers> phones)  
{  
    RadPanelItem pnl = rpbSeller.FindItemByValue("General");  
    RadGrid grid = pnl.FindControl("rgSeller"as RadGrid;  
    grid.DataSource = sellers;  
    grid.DataBind();  
 
    //some other ancilliary methods  


Here is the code for the ItemCommand Handler method of the grid:
protected void rgSeller_ItemCommand(object source, GridCommandEventArgs e)  
{  
   switch (e.CommandName)  
   {  
        case "UpdateUser":  
             string fn, ln, addr, city, st, zip, unm, email;  
             GridDataItem item = e.Item as GridDataItem;  
             GridEditFormItem editor = item.EditFormItem;  
 
             int uid = 0;  
             TextBox txt = editor.FindControl("txtFirstname"as TextBox;  
             fn = txt.Text;  
 
             txt = editor.FindControl("txtLastname"as TextBox;  
             ln = txt.Text;  
 
             txt = editor.FindControl("txtAddress"as TextBox;  
             addr = txt.Text;  
 
             txt = editor.FindControl("txtCity"as TextBox;  
             city = txt.Text;  
 
             txt = editor.FindControl("txtState"as TextBox;  
             st = txt.Text;  
 
             txt = editor.FindControl("txtZip"as TextBox;  
             zip = txt.Text;  
 
             txt = editor.FindControl("txtUsername"as TextBox;  
             unm = txt.Text;  
 
             txt = editor.FindControl("txtEmail"as TextBox;  
             email = txt.Text;  
 
             Presenter.UpdateUser(uid, fn, ln, addr, city, st, zip, unm, email);  
             RadGrid grid = e.Item.Parent as RadGrid;  
             grid.Rebind();  
             rgAction.Rebind();  
             break;  
       case "Cancel":  
       default:  
         break;  
   }  
Everything LOOKS correct, and actually provides access to the necessary controls in the template.  However, if I change anything in the Edit form, that edits are not available to me on the postback.  Any Suggestions?
Andrew
Top achievements
Rank 2
 answered on 13 Apr 2010
1 answer
71 views
how can I display the context menu when user left clicks a node? Thanks.
Tim McKnight
Top achievements
Rank 1
 answered on 13 Apr 2010
1 answer
179 views
I am using GridBinaryImageColumn in RadGrid.
In IE8 I get broken image sign if there is no data for this particular row.
Is there any built-in solution to avoid this ?
Jacob
Top achievements
Rank 1
 answered on 13 Apr 2010
1 answer
201 views
on my radgrid I have a template column with a databound label. there is also a radtooltip control for this label.
when I mouse over the headertext the mouse curser becomes a hand shape and i get a popup saying "Click here to sort"
when i mouse over the rest of the header column area the course turns into a cross and i get a popup sayihng "Drag to group or reorder"
Where is my tooltip text? Is there a way to show the tooltip text instead of the default message?
thanks in advance
Daniel
Telerik team
 answered on 12 Apr 2010
9 answers
278 views
Does anyone have a way to make cells in a row have a unique color based on having a particular value?  It is "Conditional Formatting" only for a single cell versus an entire row.  Each row could have multiple occuranges of this value and I'd like to change each of these cells to yellow.  Ideas?  Not an entire column or an entire row......just individual cells.

Thanks in advance.
Doug
Brian Azzi
Top achievements
Rank 2
 answered on 12 Apr 2010
2 answers
308 views
I have been able to dynamically load some dropdown lists to be used during an inplace edit in the RadGrid. I do this within the ItemCreated event of the grid. 

I also attach a SelectedIndexChange event to one of the dropdowns (call it dropdown "A"). I need to change the selected index of a different dropdown within the same row (call it dropdown "B") when the user changes the selected index in dropdown A.

The event fires and I can retrieve a new selected value in A, but now I'm at a loss as to how to retrieve the approiate dropdown B to alter it's selected index based on the value chosen in A. I don't have visiblity to a grid "item" from the SelectedIndexChanged event and the databound event doesn't seem to fire when dropdown A's event fires - so I can't get access to the grid item to do a FindControl on dropdown B. I have the AutoPostBack property of dropdown A set to "true".

Any suggestinons? 
Charles
Top achievements
Rank 2
 answered on 12 Apr 2010
1 answer
190 views
Hello,

I have a RadComboBox and have created a Checkbox column via an ItemTemplate.  The RadComboBox is bound dynamically in the code behind. 

Is there an easy way to insert a default record for the RadComboBox on databind, then once that first default record is selected by the user, the rest of the checkboxes in the RadComboBox are selected (acting as a "select all" checkbox)?

Here's my ASPX Code:
<telerik:RadComboBox ID="ddlProjects" EnableScreenBoundaryDetection="False" EmptyMessage="Select Project(s)"  runat="server">  
   <ItemTemplate>   
      <asp:CheckBox runat="server" ID="CheckBox" Text="" /> <%#DataBinder.Eval(Container, "Text")%>   
   </ItemTemplate>    
</telerik:RadComboBox> 

Here's id my VB Code:
    Protected Sub ddlProjects_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlProjects.Load  
        Try  
            If Not Page.IsPostBack Then  
                ddlProjects.DataSource = l_oUniversal.PopulateDropDownList("sprocSchedule_Get_ProjectNames")  
                ddlProjects.DataValueField = "ProjectID" 
                ddlProjects.DataTextField = "ProjectName" 
                ddlProjects.DataBind()  
                ddlProjects.Items.Insert(0, New RadComboBoxItem(""))  
            End If  
        Catch ex As Exception  
            ' Log Error  
        End Try  
    End Sub 

Thanks!
Jason
Jason Zam
Top achievements
Rank 1
 answered on 12 Apr 2010
4 answers
179 views

i m very Confuse, i have to find "chk" Control  in my Codebehind file

<A

 

ppointmentTemplate>

 

 

 

 

 

 

 

 

 

<asp:CheckBox ID ="chk" Text='<%#Eval("ID")%>' runat="server" CssClass="test" OnCheckedChanged="alert('dsfa');" />

 

 

 

 

<asp:Label ID="lblChanelID" runat="server" Text='<%#Eval("Subject")%>'></asp:Label>

 

 

 

 

</AppointmentTemplate>
basically i have provided checkbox in all my appointment, i want to track which apointment is checked by user and which apointment is not checked by user  for that purpose i have to get the referance of Check box that is inside the <AppointmentTemplate> so how i can acess controls that is  inside <AppointmentTemplete> and get it referance according to check box TEXT property;

thanks
Muhammad ali

 

 

 

Veronica
Telerik team
 answered on 12 Apr 2010
2 answers
125 views
Does anyone know, I'm converting from the old ASP.NET controls to the AJAX controls.  I used the Monochrome skin in my web pages.  Is there an equivalent skin I can convert to in the AJAX controls?  Thanks.

Dan
Dan
Top achievements
Rank 2
 answered on 12 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?