Telerik Forums
UI for ASP.NET AJAX Forum
10 answers
686 views
I have a grid that binds on !IsPostBack in Page_Load, the grid has a GridClientDeleteColumn column with AutoGenerateColumns="true".  Everything works great until I start binding the grid on ClientSide, then I lose the GridClientDeleteColumn icon and functionality for the grid (only the new row do not have the GridClientDeleteColumn icon), however if I do a post-back on the page then any client side binding after will have the GridClientDeleteColumn.

The reason I am binding at Page_Load is so I get all the column names from my data object.  After the initial first bind (on server side), I am binding from the client side for speed so I don't have to do a full post back after I add/delete/modify my grid data rows.

Code:
ASPX code
-----------------------------------------------------------------------------------------------------------
<script language="javascript">
function AddProduct(productID){
          var myGrid = $find("<%=myGrid.ClientID%>");
          PageMethods.AddProduct(productID, OnSucceeded,OnFailed);
          myGrid.MasterTableView.rebind();        
}

function OnSucceeded(result, userContext, methodName) {
...
}

function OnFailed(error, userContext, methodName) {
...
}

</script>

<telerik:RadGrid ID="myGrid" runat="server" AllowAutomaticUpdates="True"
                                            AllowFilteringByColumn="False" AllowPaging="False" AllowSorting="True"
                                            AutoGenerateColumns="True" EnableEmbeddedSkins="false" EnableViewState="False"
                                            FilterItemStyle-HorizontalAlign="Left" GridLines="None"
                                            GroupHeaderItemStyle-HorizontalAlign="Left"
                                            PageSize="25" ShowFooter="True" EnableClientKeyValues="true"
                                            ShowGroupPanel="false" ShowStatusBar="True" Skin="Sunset">
                                    <clientsettings allowcolumnsreorder="False" allowdragtogroup="False"
                                            reordercolumnsonclient="False">
                                        <clientevents OnRowDeleting="RowDeleting"></clientevents>
                                        <selecting allowrowselect="false" />
                                        <DataBinding Location="MyPage.aspx"
                                            SelectMethod="GetData" SortParameterType="String" EnableCaching="false"
                                            DataPropertyName="Data" CountPropertyName="Count" />
                                    </clientsettings>                           
                                    <mastertableview clientdatakeynames="ProductID"
                                            datakeynames="ProductID" name="MasterTableView">
                                        <columns>                                    
                                            <telerik:GridClientDeleteColumn ConfirmText="Delete this item?" ButtonType="ImageButton"
                                                ImageUrl="delete.gif" CommandName="Delete" Text="Delete">
                                            </telerik:GridClientDeleteColumn>                                                                                    
                                            <telerik:GridBoundColumn UniqueName="ProductID" DataField="ProductID" HeaderText="ProductID">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="ProductName" DataField="ProductName" HeaderText="Product Name">
                                            </telerik:GridBoundColumn>                                            
                                        </columns>
                                    </mastertableview>
 </telerik:RadGrid> 

Add Test Product: <input type="button" id="btnClientButton" onclick="AddProduct(12345)">

<asp:Button id="btnServerButton" OnClick="btnServerButton_Click" runat="server" Text="Do a Post Back Then Everything is A-OK">
-----------------------------------------------------------------------------------------------------------
Server Side Code:
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                        myGrid.DataSource=GetData("")["Data"];
                        myGrid.DataBind();
            }
        }

        [WebMethod(true)]
        public static Dictionary<string,object> GetData(string sortExpression)
       {
                  .
                  .
                  data.add("Data",objDataList);
                  data.add("Count",objDataList.Count);
                  return data;
       }

        [WebMethod(true)]
        public static bool AddProduct(int productID)
        {
                  .
                  .
                  objDataList.Add(productID)        

                  return true;
        }

Why is it that only when there's a post back (at least one post back) then the GridClientDeleteColumn will show when I do a client databind/rebind?



Antonio Stoilkov
Telerik team
 answered on 09 Jan 2012
6 answers
203 views
Hi
I undertand I can set width or max-width of node image using css:

#ExploreTreeView img

{

max-width:16px;

max-height:16px

}


I would like to be able to set the image max width programatically though as it needs to be different for certain nodes.
I noticed there is a style property with RadTadTreeNode, I tried this:

C#
newNode.Style.Value= "img {max-width:22px}";
I really don't know if this syntax is correct, but this doesn't work for me.

Can anyone suggect the right way for me to define the image width/max-width programatically?


Thanks
Richard

 

richard
Top achievements
Rank 1
 answered on 09 Jan 2012
0 answers
54 views
Hi,

Using telerik ajax panel. There are a number of buttons and these buttons in the panel due to running events. I am running these events. But i don't use the panel for a while for example 2 minute or 1 minute. Events don't work. The loading panel is calling, do postback but event's doesn't work. What is poblem...
ne2000
Top achievements
Rank 1
 asked on 09 Jan 2012
3 answers
247 views
Hi telerik team,
  
        I have a problem for use rad editor with ribbon mode. i need to hide button and button group on ribbon bar. i use tools file for generate toolbar. Can i do that.


thank for advance :)
Rumen
Telerik team
 answered on 09 Jan 2012
7 answers
371 views
Hello,

I'm having difficulty getting a context menu to expand to the width of the current node's text.  The tree view's context menu in your examples solution always expands to the width of the menu item's text, but I could not find any references where the width of the context menu or its items is explicitly being set.

I'm also using the same jscript function: setMenuItemsState to set the menu item's text.

Please advise.
Kate
Telerik team
 answered on 09 Jan 2012
1 answer
116 views
Hello everyone!

just tried to display in RadSlider tooltip with image. 

with this codes it is ok but displaying 2 image side by side. 
div.innerHTML = "<img src='images/" + slider.get_selectedItems()[0].get_value() + ".gif' width='50' height='64'> <img src='images/"  + slider.get_selectedItems()[1].get_value() + ".gif' width='50' height='64' >";

with this code displaying image good for every step but when i sliding right handle it displaying only  first image 
div.innerHTML = "<img src='images/" + slider.get_selectedItems()[0].get_value() + ".gif' width='50' height='64'> <img src='images/"  + slider.get_selectedItems()[1].get_value() + ".gif' width='50' height='64' >";
        else
 
            div.innerHTML = "<img src='images/" + slider.get_selectedItems()[1].get_value() + ".gif' width='50' height='64'> ";


so target is
when i sliding right handle tooltip displaying right image.
any help?
Regards


Slav
Telerik team
 answered on 09 Jan 2012
1 answer
80 views
Hi
I have a treeview which bind to a Datatable  which is code in the follow
private void fillContractItem()
  
{
  
trvContractItem.DataFieldID = "iNumber";
  
trvContractItem.DataFieldParentID = "iParentNumber";
trvContractItem.DataTextField = "strName";
trvContractItem.DataValueField = "iNumber";
 trvContractItem.DataSource = objContractItem.SelectAll();
trvContractItem.DataBind();
  
}


I want node sort by a filed(name filed is orderfiled in in datatable
how i can move  nodes to up or down in a level  then save order nodes in orderfiled and load nodes by orderfiled and show to users
thanks 
Plamen
Telerik team
 answered on 09 Jan 2012
1 answer
69 views
Im having a problem styling the first level (0) the same as the rest of the levels.
It seems to be the class of the first ul is rsmLevel instead of rsmNodeLines which the other levels has.

Im trying to create a single vertical tree (kind of like a treeview) where all the levels have nodelines, but like I said, the first level looks weird, but all the other levels are fine.

Any suggestions?
Kate
Telerik team
 answered on 09 Jan 2012
2 answers
94 views
I have a form with a RadGrid which is data bound to a DataTable as  the page is loaded server side.  I have defined my grid as :-

<telerik:RadGrid ID="gridParts" runat="server" AllowSorting="True" CellSpacing="0" Height="690px" OnSelectedIndexChanged="gridParts_SelectedIndexChanged" AllowMultiRowSelection="False">
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="true" TableLayout="Fixed" DataKeyNames="PartNumber" AllowCustomSorting="false" AllowMultiColumnSorting="false" AllowNaturalSort="false" Alloo>
</MasterTableView>
<ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">
<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" AllowResizeToFit="true" ClipCellContentOnResize="true" EnableRealTimeResize="true" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />
</ClientSettings>
</telerik:RadGrid>

From the documentation this should allow simple sorting to work.  I only have 2 columns in the grid which are auto-generated.  My problem is that nothing appears to happen when I click the column header to sort the items.  To I need to add anything else just to implement simple ascending/descending sorting?
Shinu
Top achievements
Rank 2
 answered on 09 Jan 2012
1 answer
56 views
Hi,
I've experienced odd behavior with the RadTreeView when i got 3 levels of nodes.. first 2 leves are normal checkable nodes and the 3. level is uncheckable nodes for info etc.
When i check any of the nodes on the 2. level, the parent node is checked even though it should be marked as undetermined.. first bug. When i uncheck the node i just checked, the parent node still remain checked.

Markup:
<telerik:RadTreeView ID="RadTreeView1" runat="server" ExpandAnimation-Type="None"
CheckBoxes="true" TriStateCheckBoxes="true">
</telerik:RadTreeView>


Code:
   protected void Page_Load(object sender, EventArgs e)
        {
            RadTreeView1.Nodes.Clear();
            RadTreeNode node = null;
 
            node = new RadTreeNode("AAA", "aaa");
            RadTreeView1.Nodes.Add(node);
            AddNodes(node);
        }
 
        private void AddNodes(RadTreeNode parent)
        {
            RadTreeNode node = null;
 
            node = new RadTreeNode("111", parent.Value + "_111");
            AddInfoNodes(node);
            parent.Nodes.Add(node);
 
            node = new RadTreeNode("222", parent.Value + "_222");
            AddInfoNodes(node);
            parent.Nodes.Add(node);
        }
 
        private void AddInfoNodes(RadTreeNode parent)
        {
            RadTreeNode node = new RadTreeNode("foo", parent.Value + "_bar");
            node.Checkable = false; //Without this line everything works like it should....
            parent.Nodes.Add(node);
        }

Regards
Nikolaj Strauss
GROUP Live
Bozhidar
Telerik team
 answered on 09 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?