Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
123 views
Hi,

After a very long struggle, I managed to get buttons on my grid group headers. (Still there is an issue with it, like a postback making the controls to  vanish - Anyway, I'll look into it later) As of now, I've added buttons to the group header items and also I have defined an event-handler for the button click event.

Please see my code below for the radgrid_ItemDataBound event

if

 

(e.Item is GridGroupHeaderItem)

 

{

     

           Button

 

btnModifyStrategy = new Button();

 

           btnModifyStrategy.Text =

"Modify Strategy";

 

           btnModifyStrategy.CssClass =

"tab4-sub1btn";

 

 

            //btnModifyStrategy.UseSubmitBehavior = false;

 

           btnModifyStrategy.Click +=

new EventHandler(btnModifyStrategy_Click);

 

          groupheader.DataCell.Controls.Add(btnModifyStrategy);

}


The button is added to the group header now. But when I click on the button, the button click event is not fired. Its driving me too crazy as I've been into this problem since this morning.

Can you advise me on this?

Thanks in advance.

Sangeetha


Princy
Top achievements
Rank 2
 answered on 24 Mar 2010
10 answers
817 views
I have a RadGrid on my page, with a button in the CommandItemTemplate.  I want to execute a client function to determine if I need to postback to do some work to do something else on the client side.  When I do this, the button no longer causes a postback.  It will not postback even if I simplet do OnClientClick="return true;".  Is there a way to work around this.  Here is some sample code.

ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridTest._Default" %> 
 
<%@ 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 runat="server">  
    <title>Untitled Page</title> 
    <script language="javascript" type="text/javascript">  
        function onBtnClick()  
        {  
            return true;  
        }  
    </script> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager runat="server">  
    </telerik:RadScriptManager> 
       <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="lbl" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <div> 
    <asp:Label ID="lbl" runat="server"></asp:Label> 
        <telerik:RadGrid ID="RadGrid1" Skin="WebBlue" Width="500" runat="server" GridLines="None"   
            onitemcommand="RadGrid1_ItemCommand">  
          
<MasterTableView CommandItemDisplay="Top">  
    <CommandItemTemplate> 
        <asp:Button ID="btnCmd" CommandName="ShowTime" OnClientClick="return onBtnClick();" runat="server" Text="Do Something" /> 
    </CommandItemTemplate> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
</MasterTableView> 
          
        </telerik:RadGrid> 
      
    </div> 
   
    </form> 
</body> 
</html> 

Here is the c# code behind:
using System;  
using System.Collections;  
using System.Collections.Generic;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.HtmlControls;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Xml.Linq;  
 
namespace GridTest  
{  
    public partial class _Default : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!IsPostBack)  
            {  
                List<Sample> sampleList = new List<Sample>();  
                for (int x = 0; x < 15; x++)  
                {  
                    Sample s = new Sample();  
                    s.Name = String.Format("Name {0}", x);  
                    s.Description = String.Format("Description for item {0}", x);  
                    sampleList.Add(s);  
                }  
 
                RadGrid1.DataSource = sampleList;  
                RadGrid1.DataBind();  
            }  
        }  
 
        protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
            if (e.CommandName == "ShowTime")  
            {  
                lbl.Text = String.Format("Processed at {0}.", DateTime.Now.ToLongTimeString());  
            }  
        }  
    }  
 
    public class Sample  
    {  
        public string Name { get; set; }  
        public string Description { get; set; }  
    }  
}  
 

Thanks,
Doug
kachy
Top achievements
Rank 1
 answered on 24 Mar 2010
1 answer
99 views
Hi

I just replicate some of the editor built-in functions to my top toolbar, most of them works fine. e.g. Bold, HR, but I cannot make "InsertSymbol","InsertTable", "StripAll" work.  If I use "editor.fire("StripAll")" I will receive "undefine xxxxxxx" error.

Dobromir
Telerik team
 answered on 24 Mar 2010
1 answer
110 views
I have a button on a page and an xmlhttppanel that encloses an asp:Literal. Users click the button and a webservice is invoked that returns 3 comboboxes and another button into the Literal.

My intention is that the users may select items in the comboboxes, click the button, the webservice is invoked again and I am able to inspect any of the controls within the form of the page within the webservice. I want to repeat this several times, each time returning a different combination of comboboxes, radiobuttons and other html elements.  

My motivation is I do not want to post the entire page back, I want to update the Literal only. Because my html will change each time, its difficult to write a single javascript function to collect all values of html controls on the page and submit them to the web service.

Is there a way to access the page form from the webservice using xmlhttppanel? If not, is there a better approach?
Pero
Telerik team
 answered on 24 Mar 2010
3 answers
178 views
I have two grids which have the same amount of rows, but the heights of the rows are not the same.  Is it possible to loop through both tables and set the row height in each table to the same amount?  The first table is going to have a dynamic row height, and I would like the second table to have the same row heights as the first table.  Is this possible?

Thanks!
Yavor
Telerik team
 answered on 24 Mar 2010
4 answers
153 views
Hi,
we have 2008.03.1314.35 version of control where we found a peculiar problem, when we select the item from drop-down and click out side the combo box then it reset it's text by old text.

    <telerik:RadComboBox ID="RadComboBox1" runat="server"  Skin="Office2007"  EnableLoadOnDemand="false" AutoPostBack="false" MarkFirstMatch="true" Height="100px" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
    </telerik:RadComboBox>
     
regards,
Sanjeev
Sanjeev
Top achievements
Rank 1
 answered on 24 Mar 2010
3 answers
83 views
Hi
I wonder if anyone can give us any guidance on (or - better still - examples of) how to use Telerik controls to create a compiled library of copmposite user controls for use across several websites?

We have a series of "selector" user controls which have several Telerik text boxes (to give search paramters) and a final combo to select a company, person, etc. We also have user controls with Telerik grids with right-click menus (Telerik contect menus). We want to put these in a separate project and compile them into a dell that we can use on several websites, to share their functionality and to add properties (eg the ID from the final combo) that can be accessed from our code libraries.

Is there any problem in using Telerik controls in compiled user controls (because they are, themselves, compiled composite user controls)? Can we use a RAD proxy manager in each user control so that it does not make the parent pages postback for each internal event? Or will we need a proxy manager because they need to be self-vontained? Is there going to be a problem using a contect menu inside a compiled user control? If we succeed in crwating the dll with all these controls, and we add a reference to the dll in each website, will we be able to see our control collection in the Visual Studio toolbox, so that we can simply drag them onto our pages? Do we need interfaces to enforce standard properties and methods? Can we add our own event handlers for the composite controls?

Any advice will be welcome and I hope others will also be able to create control libraries from the guidance we collect. If anyone has an existing collection of user controls like this that they are willing to let us examine, it would be even better - we are prepared to offer ours if someone helps us to create it !

Living in hope! Neil
Sebastian
Telerik team
 answered on 24 Mar 2010
23 answers
355 views
Hi,

I am trying to implement the radeditor in MOSS2007 with the following piece of code:

<add tagPrefix="radE" namespace="Telerik.SharePoint.FieldEditor" assembly="RadEditorSharePoint, Version=5.0.0.0, culture=neutral, PublicKeyToken=1f131a624888eeed" />

When I open the page in editing mode, the error 'Please wait while scripts are loaded' stays in the IE status bar.

I hope somebody has a solution for this.

Best regards,
Bas Hammendorp
Stanimir
Telerik team
 answered on 24 Mar 2010
1 answer
46 views
Hi folks.

i have implemented a radgrid and did all the necessary things to enable paging,sorting,filtering etc.

but when i do any of the operation i get.

"Object reference not set to an instance of an object"

Can any one help me out on this....

Thanks
Satya
Nikolay Rusev
Telerik team
 answered on 24 Mar 2010
1 answer
182 views
Ok... all you style guru's out there, help me out. ;)

Here is my scenario... I'm writing a "file browser" type grid that will peruse various file sources. I have an image column and then a name column. This works fine... BUT, I can't get the image (in column 0) to lineup with the text in column 1. They should be flush or close to each other...

So I guess what I need is to remove the padding from cell 0 right and cell 1 left.... is this something reasonable to do? 

Here are my column definitions (bound via client side load):

<Columns> 
                    <telerik:GridImageColumn DataImageUrlFields="Icon" DataImageUrlFormatString="images/{0}" HeaderText="" HeaderStyle-Width="32" Resizable="false" /> 
                    <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="false" /> 
                    <telerik:GridBoundColumn DataField="SizeDisplay" UniqueName="SizeDisplay" HeaderText="Size" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Wrap="false" /> 
                    <telerik:GridBoundColumn DataField="Type" UniqueName="Type" HeaderText="Type" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="false" /> 
                    <telerik:GridBoundColumn DataField="DateModified" UniqueName="DateModified" HeaderText="Date Modified" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="false" /> 
                    <telerik:GridBoundColumn DataField="IsFolder" UniqueName="IsFolder" Visible="false" /> 
                    <telerik:GridBoundColumn DataField="Size" UniqueName="Size" Visible="false" /> 
                    <telerik:GridBoundColumn DataField="FullPath" UniqueName="IsFolder" Visible="false" /> 
                </Columns>  

Something of note... I think a template column would be great (and have an image control next to a label), but since I am loading data on the client, it doesn't seem to work... bleh.

-Brian
Dimo
Telerik team
 answered on 24 Mar 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?