Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
916 views

I currently have a page that dynamically loads a user control when a button click is executed.  The user control is placed on the page and loaded within a radajaxpanel.  I need to run a javascript function at the completion of the user control being loaded that accesses controls within that user control.  I have tried a few different ways to get this to happen, but I am unable to get it to work.

What does work is when I remove the radajaxpanel and then at the bottom of the ascx page I include the javascript function that I want to run followed by window.onload = functionToRun, but then I get the page reload etc. 

I have tried to register the script at prerender, and also tried the following in the Page_PreRender of the user control to run the desired function:

 

System.Web.UI.

 

Page page = (System.Web.UI.Page)this.Page;

 

 

 

MasterPage mp1 = (MasterPage)page.Master;

 

 

 

RadAjaxManager ajm = mp1.FindControl("RadAjaxManager1") as RadAjaxManager;

 

 

 

string script = String.Format("functionToRun();");

 

ajm.ResponseScripts.Add(script);

It finds the objects it needs within the codebehind, but then cannot find the functionToRun when it is time to run the client side function.

Is there a post or article that describes the best way to run a client side function once a dynamically loaded user control has finished loading within a RadAjaxPanel?

Thank you,

Aaron

Antonio Stoilkov
Telerik team
 answered on 12 Jan 2012
1 answer
209 views

Hi,

I'm getting the "A generic error occurred in GDI+" error message while using the following code:

using (System.Drawing.Image originalImage = System.Drawing.Image.FromStream(upload.UploadedFiles[0].InputStream))
{
//Create empty bitmap image of original size
Bitmap tempBmp = new Bitmap(originalImage.Width, originalImage.Height);
Graphics g = Graphics.FromImage(tempBmp);
//draw the original image on tempBmp
g.DrawImage(originalImage, 0, 0, originalImage.Width, originalImage.Height);
//dispose originalImage and Graphics so the file is now free
g.Dispose();
originalImage.Dispose();
Response.ContentType = "image/jpeg";
//Save the image file to original location
tempBmp.Save(Server.MapPath("~Products/General/Imgs/Menus/" + parentSysName + "/" + productID.ToString() + "_" + upload.UploadedFiles[0].FileName), System.Drawing.Imaging.ImageFormat.Jpeg);
}

Can you please help me how to solve this problem?
By the way, I looked on the internet, but I didn't found anything.

Regards,
Bader

Bader
Top achievements
Rank 1
 answered on 12 Jan 2012
7 answers
349 views
I have a large dataset that I am filling a combobox with via web service.  The dropdown and service work, but when I select an item from the dropdown I get "The server method MyMethod failed ", then the page processes and completes the request just like it should. Does anyone have any suggestions on how to stop the error box from popping up? or stop it from erroring at all. Any help would be great.
Thanks

    [WebMethod]
    public RadComboBoxData GetAltIdId(RadComboBoxContext context)
    {
        string sql = "SELECT  ALTID, ID FROM PEOPLE WHERE ID LIKE @text + '%'";
 
        SqlDataAdapter adapter = new SqlDataAdapter(sql,
            ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        DataTable data = new DataTable();
 
        adapter.SelectCommand.Parameters.AddWithValue("@text", context.Text);
        adapter.Fill(data);
 
        List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(context.NumberOfItems);
        RadComboBoxData comboData = new RadComboBoxData();
        try
        {
 
            int itemsPerRequest = 10;
            int itemOffset = context.NumberOfItems;
            int endOffset = itemOffset + itemsPerRequest;
            if (endOffset > data.Rows.Count)
            {
                endOffset = data.Rows.Count;
            }
            if (endOffset == data.Rows.Count)
            {
                comboData.EndOfItems = true;
            }
            else
            {
                comboData.EndOfItems = false;
            }
            result = new List<RadComboBoxItemData>(endOffset - itemOffset);
            for (int i = itemOffset; i < endOffset; i++)
            {
                RadComboBoxItemData itemData = new RadComboBoxItemData();
                itemData.Text = data.Rows[i]["ID"].ToString();
                itemData.Value = data.Rows[i]["ALTID"].ToString();
 
                result.Add(itemData);
            }
 
            if (data.Rows.Count > 0)
            {
                comboData.Message = String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString());
            }
            else
            {
                comboData.Message = "No matches";
            }
        }
        catch (Exception e)
        {
            //comboData.Message = e.Message;
        }
 
        comboData.Items = result.ToArray();
        return comboData;
    }}
-----------------------------------------------
<script type="text/javascript">
    function OnClientItemsRequesting(sender, eventArgs) {
        var context = eventArgs.get_context();
        context["FilterString"] = eventArgs.get_text();
    }
 
</script>
<telerik:RadComboBox runat="server" ID="RadComboBox1" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
    OnClientItemsRequesting="OnClientItemsRequesting" EnableLoadOnDemand="true" ItemsPerRequest="10"
    ShowMoreResultsBox="True" EnableVirtualScrolling="True" Filter="Contains" EmptyMessage="Enter A#"
    AppendDataBoundItems="true" AutoPostBack="true">
    <WebServiceSettings Method="GetAltIdId" Path="../PeopleSearch.asmx" />
</telerik:RadComboBox>
--------------------------------
    protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string url = Path.GetFileName(Request.Path);
        url += "?HNUMBER=" + RadComboBox1.SelectedValue.ToString();
        Response.Redirect(url);
    }

Helen
Telerik team
 answered on 12 Jan 2012
3 answers
103 views
We are using Google like Filtering for the columns in a grid. The Filtering works fine for all the columns except for two columns which are displaying dates. The Format for the column in the Grid as well as the format for the date in the RadCombo(used for type ahead) is

"{0:dd-MMM-yyyy}".
Please suggest a solution.We are using a class file for this which is like your Demo File (CustomFilteringColumn.cs)

Tsvetina
Telerik team
 answered on 12 Jan 2012
3 answers
74 views
Installed the Sharepoint Acceleration Kit.  Deployed the solution, turned the feature on and inserted the SPRadChartWebPart into a blank page on a website.  I seem to be able to adjust all properties of the web part, including the color palette (which opens a pop up page).  When I try and open the Series and Data Source I recieve a sharepoint error.  Tracing this to the ULSTraceLog view on the WSS_Logging database I looked the error up using the correlationID and here is the stack trace:

System.NullReferenceException: Object reference not set to an instance of an object.   
at SPRadChartWebPart.Layouts.SPRadChartWebPart.ManageSeries.LoadMappingValues(RadComboBox mappingsCombo)    
at SPRadChartWebPart.Layouts.SPRadChartWebPart.ManageSeries.BindMappingCombos()    
at SPRadChartWebPart.Layouts.SPRadChartWebPart.ManageSeries.Page_Load(Object sender, EventArgs e)    
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)    
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)    
at System.Web.UI.Control.OnLoad(EventArgs e)    
at Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.OnLoad(EventArgs e)    
at Microsoft.SharePoint.WebControls.LayoutsPageBase.OnLoad(EventArgs e)    
at System.Web.UI.Control.LoadRecursive()    
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Anyone have any ideas why this is happening?

Thanks,

Ryan
Evgenia
Telerik team
 answered on 12 Jan 2012
1 answer
279 views
Hi,
The error - The 'SelectedIndex' and 'SelectedValue' attributes are mutually exclusive.
appears when i create a recurring appointment 

ex:
From - today 10am, to - today 11am,  recurring - yes
recurrence - yearly,
Every - Feb 10 (use any other month than the current month)

the above mentioned error occurs when I use any other month than the current month/any other month than the month used in From/To fields


any help?
Ivana
Telerik team
 answered on 12 Jan 2012
0 answers
113 views
Hi to all
           I am using rad editor,I need to disable some controls from it.Below is attached  Image which tell you what controls I want to hide or disable, I request you to view and help me in hiding the unwanted controls from "Rad Editor"
Siddiqali
Top achievements
Rank 1
 asked on 12 Jan 2012
1 answer
74 views
How do I handle this scenario.

I have a "Status" table which assigned StatusIDs to another table.

In my Edit form I have the Status ComboBox filtered to only show a few of those items.  So 10% of my items are items NOT in this list...so when the edit form loads I get a YSOD because the items its trying to Two-way bind with isn't in the combo.

How should I handle this scenario?
Ivana
Telerik team
 answered on 12 Jan 2012
2 answers
257 views
Hi,

I am getting very strange issue in the Rad ComboBox. When my Combo box opens, The Items are not visible properly as the background of the combobox is getting transparent.
This issue is only reproduced in IE. It works fine in Mozilla and Fire Fox.

How can this issue be resolved.

Thanks in advance
Vaishnav
Ivana
Telerik team
 answered on 12 Jan 2012
5 answers
316 views
Hi All,
I am trying to display items in one source RadListBox and transfer to destination RadListBox.
Here is my code
...  
<tr> 
            <td> 
                 <asp:Label ID="Label3" runat="server" Text="Search items :"></asp:Label>&nbsp;&nbsp;&nbsp;<asp:TextBox ID="txtSearch" runat="server" onkeyup="highlightItems();"></asp:TextBox>                           
                 <telerik:RadListBox ID="rlbSource" runat="server" AllowTransfer="true" CssClass="listBoxText" 
                    Height="200px" SelectionMode="Multiple" TransferToID="rlbDestination" Width="450px" AllowTransferOnDoubleClick="true">  
                    <ButtonSettings ShowTransferAll="false" VerticalAlign="Middle"/>  
                    <ItemTemplate> 
                        <asp:Label ID="Label4" runat="server" Text='<%#  DataBinder.Eval(Container.DataItem, "SYSTEM_DESCRIPTION") %>' SkinID="valuetext"></asp:Label> 
                        <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Label4" RelativeTo="Element" 
                            Position="BottomCenter" RenderInPageRoot="true" Width="300" CssClass="listBoxText">  
                            <b>System Particulars :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "SYSTEM_PARTICULARS")%> 
                            <br /><b>Maker :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "MAKER")%> 
                            <br /><b>City :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "CITY")%> 
                            <br /><b>Country :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "COUNTRY")%> 
                        </telerik:RadToolTip> 
                    </ItemTemplate>                                       
                </telerik:RadListBox> 
            </td> 
            <td> 
                <telerik:RadListBox runat="server" ID="rlbDestination" Height="200px" Width="450px"    
                     CssClass="listBoxText" AllowDelete="True" SelectionMode="Multiple">   
                     <ItemTemplate> 
                        <asp:Label ID="Label4" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SYSTEM_DESCRIPTION") %>' SkinID="valuetext"></asp:Label> 
                        <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="Label4" RelativeTo="Element" 
                            Position="BottomCenter" RenderInPageRoot="true" Width="300" CssClass="listBoxText">  
                            <b>System Particulars :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "SYSTEM_PARTICULARS")%> 
                            <br /><b>Maker :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "MAKER")%> 
                            <br /><b>City :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "CITY")%> 
                            <br /><b>Country :</b><br /> 
                            <%# DataBinder.Eval(Container.DataItem, "COUNTRY")%> 
                        </telerik:RadToolTip> 
                    </ItemTemplate>                                               
                </telerik:RadListBox> 
            </td> 
              
        </tr>   
... 

and in the page_load event  I am doing this
       if (!Page.IsPostBack)  
        {  
            rlbSource.TransferMode = ListBoxTransferMode.Copy;  
            rlbDestination.DataBind();  
            rlbDestination.EmptyMessage = "No items added";  
        } 
rlbSource.DataSource =  //call the function that returns a datatable.         
rlbSource.DataValueField = "SYSTEM_CODE";  
rlbSource.DataTextField = "SYSTEM_DESCRIPTION";          
rlbSource.DataBind(); 

I have 3 problems here
1. Where I transfer the items from source to destination in the destination listbox the tooltip is not appearing.
2. The delete button in destination listbox is is always disabled
3. For some items in the destination the tooltip content is also displayed in the item text.

Please help to resolve these issues. Thanks in advance.

Andrew Galea
Top achievements
Rank 1
 answered on 12 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?