Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
2.1K+ views
How can I create a RadGrid row programmatically?

I need to loop through the existing rows in the Radgrid and add a new row on a button click, ie., based on the number of existing rows a new row needs to be added.

or is there any way to get the ROWCount at the server-side?

Please guide me......
Neerav
Top achievements
Rank 1
 answered on 29 Nov 2010
2 answers
222 views

I tried the solution suggested and didn't work.
I think my problem is related to Framework 4.0, 
Web.config content
--------------------------
    <compilation debug="true" targetFramework="4.0">
      <assemblies>

        <add assembly="Telerik.Web.UI, Version=2008.3.1314.35, Culture=neutral, PublicKeyToken=121FAE78165BA3D4" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Drawing.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
    </compilation>
 
    <httpHandlers>
      <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2008.3.1314.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false" />
      <add path="Telerik.RadUploadProgressHandler.ashx" verb="*" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI" />
 </httpHandlers>

Bold line is highlighted in red when error occurs, I had copied file Telerik.Web.UI.dll to bin.

Thanks in advance.

Steve
 

Steve
Top achievements
Rank 1
 answered on 29 Nov 2010
3 answers
96 views
Hello,
             I have a radtooltip inside a usercontrol, I put the user control inside another radpane. When the tooltip shows up it shows only part of it and the rest is hidden behind the radpane. Is there a way to show the tooltip on top?..

Thanks,
Bharani
Bharani Mani
Top achievements
Rank 1
 answered on 29 Nov 2010
3 answers
662 views

Problem 1:
I have found a link on how to adjust the width of declaritive columns through code behind:
http://www.telerik.com/help/aspnet-ajax/grdusingcolumns.html

protected void RadGrid1_PreRender(object sender, System.EventArgs e)
{
 foreach(GridColumn column in RadGrid1.Columns)
 {
   if (column.UniqueName == "BirthDate")
   {
     (column as GridBoundColumn).ReadOnly = true;
     (column as GridBoundColumn).DataFormatString = "{0:D}";
     break;
   }
 }
 RadGrid1.Rebind();
}  

Although, when I use rebind() as in the example, the detailtable expand button stops working in my grid. When it is clicked the grid rebinds again and the rows never expand.
How do I get the Expand to work after implementing the above code?

Problem 2: How do I set the width of the columns in the code behind for the Detailtable? Can you please provide a simple example. Is it done in the PreRender event? Will I need to rebind the Detailtable as well?

Thanks so much for your time,
Kellie

Pavlina
Telerik team
 answered on 29 Nov 2010
5 answers
161 views
Hi all,

I have a grid that contains 8 charts and want to export this to pdf.
Following the thread http://www.telerik.com/community/forums/aspnet/grid/exception-on-pdf-export-from-grid.aspx, I've replaced the charts by .png images before.

So I have 8 .png - images, each of it has a file size of around 15KB.

When exporting this grid to pdf, the resulting document has 4 pages and a file size of around 4MB !!!
This is way too big.

I've checked the pdf export settigns and did not see anything like "DPI resolution" or "render quality" etc.
So: is there any possibility to render a grid that contains 120KB image data into a document less than 4MB?

I had another grid export containing only text, this one is only 9KB big...

greetings,
  Bernd

btw.: I'm using RadControls for Asp .Net Ajax Q1/2009
Bernd
Top achievements
Rank 1
 answered on 29 Nov 2010
2 answers
221 views
Hi,
Is any cleverly way to prepare a list of opened RadWindows and alway shows it in application (e.g. in any corner of a website)?

Thanks.
wnl
Top achievements
Rank 1
 answered on 29 Nov 2010
11 answers
245 views
I have a instance where I have a calendar that groups multiple resources together.  I added the context menu to the calendar for inserts.  When I trigger the insert command in Week or Month view the timeslot variable loads properly based on the parameters that are passed from the client script.  But when I attempt to trigger the insert command when the Day view is selected I get a IndexOutOfRangeException.  Cell index out of range: 4.

The views are setup as follows:
  • Daily: GroupBy = Room, GroupDirection = Horizontal
  • Week: GroupBy = Room, GroupDirection = Vertical
  • Month: GroupBy = ""

Code:
        Dim requestParams() As String = e.Argument.Split(Microsoft.VisualBasic.ChrW(32))  
        Dim target As String = requestParams(0)  
        Dim command As String = requestParams(1)  
        If (target = "TimeSlot"Then  
            If (command = "Insert"Then  
                Dim index As String = requestParams(2)  
  
                Dim timeSlot As ISchedulerTimeSlot = rsEvent.GetTimeSlotFromIndex(index)  
                ^---Exception when in Day view---^  

Exception:
System.IndexOutOfRangeException was unhandled by user code
  Message="Cell index out of range: 4"
  Source="Telerik.Web.UI"
  StackTrace:
       at Telerik.Web.UI.Scheduler.Views.Week.Model.GetSlotByIndex(String index)
       at Telerik.Web.UI.Scheduler.Views.Week.GroupedByResource.Model.GetSlotByIndex(String index)
       at Telerik.Web.UI.RadScheduler.GetTimeSlotFromIndex(String index)
       at Pages_Main.RadAjaxManager1_AjaxRequest(Object sender, AjaxRequestEventArgs e) in c:\inetpub\wwwroot\Scheduler\Pages\Main.aspx.vb:line 66
       at Telerik.Web.UI.RadAjaxControl.OnAjaxRequest(AjaxRequestEventArgs args)
       at Telerik.Web.UI.RadAjaxControl.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Mike
Top achievements
Rank 1
 answered on 29 Nov 2010
2 answers
153 views
Hello,

I've been using telerik/ajax for a couple of months, and I have recently hit a proplem with regards to displaying a loading panel. When the user click a button, I want to display a loading panel while the server process the data. However, I also want to run a javascript method before the post is made to the server. See my example:

 

 

 

<head runat="server">
    <title></title>
    <script type="text/javascript">
        <!--
        function addItem()
        {
            var textBoxData = document.getElementById("txtData");
  
            if (textBoxData.value.length > 0)
            {
                var listBoxData= document.getElementById("lsbSelectedData");
  
                var newLength = listBoxData.length;
                listBoxData[newLength] = document.createElement("option");
                listBoxData[newLength].text = textBoxData.value;
            }
            else
            {
                alert("Enter data");
            }
  
            textBoxData.value = "";
            textBoxData.focus();
  
            return false;
        }
  
        function submitData()
        {       
            var listBoxData = document.getElementById("lsbSelectedData");
            // Ensure that barcodes have been entered
            if (listBoxData.options.length > 0)
            {
                // Store data in a hidden field as the contexts of a listbox
                // do not get posted back to the server
                var hiddenData = document.getElementById("hdnSelectedData");
  
                var pipedData = "";
                var index;
  
                for (var index = 0; index < listBoxData.options.length; index++)
                {
                    pipedData += listBoxData.options[index].text + "|";
                }
  
                hiddenData.value = pipedData;
                return true;
            }
            else
            {
                alert("Enter data");
                var textBoxData = document.getElementById("txtData");
                textBoxData.focus();
                return false;
            }
        }
          
        // -->
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadAjaxManager ID="AjaxManager" runat="server" DefaultLoadingPanelID="AjaxLoadingPanel">
        <AjaxSettings>    
            <%--<telerik:AjaxSetting AjaxControlID="btnOK" >
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnlDataEntry" LoadingPanelID="AjaxLoadingPanel" />
                    <telerik:AjaxUpdatedControl ControlID="lblResults"  />
                </UpdatedControls>
            </telerik:AjaxSetting>--%>
        </AjaxSettings>
    </telerik:RadAjaxManager>
      
    <asp:Panel ID="pnlDataEntry" runat="server">
        <asp:TextBox ID="txtData" runat="server"></asp:TextBox>
           
        <asp:Button ID="btnAdd" runat="server" Text="Add" OnClientClick=" return addItem()" />
    </asp:Panel>
      
    <asp:ListBox ID="lsbSelectedData" runat="server" Width="300" Height="200"></asp:ListBox>    
    <asp:HiddenField ID="hdnSelectedData" runat="server" />
    <br />
    <asp:Button ID="btnOK" runat="server" Text="OK" onclick="btnOK_Click" OnClientClick="return submitData()"/>
      
    <%--<asp:Button ID="btnOK" runat="server" Text="OK" onclick="btnOK_Click"/>--%>
    <br />
    <asp:Label ID="lblResults" runat="server"></asp:Label>
      
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Height="75px" Width="75px"
        BackColor="WhiteSmoke" CssClass="loadingImage" HorizontalAlign="Center">
        <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="loading5.gif" />
    </telerik:RadAjaxLoadingPanel>
      
    </form>
</body>

C# code:

public partial class TestPage: System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
  
    protected void btnOK_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(2000);
  
        StringBuilder results = new StringBuilder();
  
        // Get the formatted data from the hidden field
        string pipedData = hdnSelectedData.Value;
  
        if (!string.IsNullOrEmpty(pipedData))
        {
            results.Append("Results:<BR />");
            string[] enteredData = pipedData.Remove(pipedData.Length - 1).Split('|');
  
            foreach (string data in enteredData)
            {
                results.AppendFormat("{0}<BR />", data);
            }
        }
        else
        {
            results.Append("Results: Nothing entered!");
        }
  
        lblResults.Text = results.ToString();
    }
}
The code above works, but if you un-comment the in the Ajax manager to enable the loading panel, the btnOK_Click on the server is never called. If you remove the OnClientClick methods from the OK button the loading panel appears, but page does not work how it was designed!.

I would like my javascript to run, the loading panel to appear, and the server to process the post back. Does anybody know what I'm doing wrong? P.S Our version of Telerik is Q2 2008.

Many thanks,

Matt

Matt
Top achievements
Rank 1
 answered on 29 Nov 2010
1 answer
98 views
Hi,
I have developed opening of radwindow using the following code.

function ShowDialogTest() {

            var wnd = window.radopen("TestUpLoad.aspx", "Test");

            wnd.setSize(700, 265);

            wnd.set_modal(true);

            wnd.center();

            wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize);

            wnd.show();           

        }     


and i am loading the radwindow using the following server side code.

protected void cmbTest_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)

    {

       

        if (e.Text.ToUpper() == "YES" || e.Text.ToUpper() == "NO")

        {

           

            ScriptManager.RegisterStartupScript(this, this.GetType(), "Test", "ShowDialogTest();", true);

 

 

//Rest Of the Code

 

 

    
//Block 1

//Block2


        }

}

but , i have been facing the following issues
1)i am unable to know how to pass a value from radwindow to the base page(from where it is called).
2)when i execute "ScriptManager.RegisterStartupScript" line to load popup, i would like to hold that line without executing till the value returns from the radwindow, based of the return value from the popup then i would like to execute either "Block1" or "Block2".

Please let me know the better solution for this.
Thanks in advance.

Cori
Top achievements
Rank 2
 answered on 29 Nov 2010
12 answers
221 views
RADMenu for AJAX 1Q 2010 running under Sitefinity 3.7 sp2 works in compatibility mode of IE 7 to use my menu specific styles (left align text, dropdown image, background and text colors, etc).

The rest of the page sees the style sheet, but not the RADMenu.

Any ideas?

Thanks,
Rich Winslow
www.automatedresults.com
828-243-5932
Amit
Top achievements
Rank 1
 answered on 29 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?