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

Hi,
I want display all image after upload, i like use upload silverlight . All step:
    1- Upload
    2- Generate thumbnail (now for testing, i just do copy to new file with prefix aa_)
    3- Display all thumbnail.

I have a problem at step 3. the last thumbnail not display, i have to right click --> choose 'show picture'.

#aspx

<telerik:RadPane ID="RadPane2" runat="server" Width="300" BorderWidth="3" BorderColor="ActiveBorder">  
             <input type="hidden" runat="server" id="UploadedFilesJson" /> 
             <center> 
             <object data="data:application/x-silverlight," type="application/x-silverlight-2" width="280" height="120" > 
                <param name="source" value='<%= ResolveUrl("~/Upload.xap") %>'/>  
                <param name="onerror" value="onSilverlightError" /> 
                <param name="background" value="white" /> 
                <param name="minRuntimeVersion" value="2.0.31005.0" /> 
                <param name="windowless" value="true" /> 
 
                <param name="autoUpgrade" value="true" /> 
                <param name="InitParams" value='<%= InitParameters %>'  /> 
 
                <href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">  
                    <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>  
                </a> 
            </object> 
            </center> 
            <div id="uploaded-files">  
            </div> 
 
 
         </telerik:RadPane> 

#Script in aspx

<script type="text/javascript">  
            var $ = $telerik.$;  
            var uploadInProgress;  
            var uploadedFiles = new Array();  
 
              
 
            function updateHiddenField() {  
                var json = Sys.Serialization.JavaScriptSerializer.serialize(uploadedFiles);  
                $get('UploadedFilesJson').value = json;  
            }  
 
            // Fired when a file is uploaded  
            function onClientFileUploaded(json) {  
                  
                var uploadedFile = Sys.Serialization.JavaScriptSerializer.deserialize(json);  
                var A = $("<img />")  
                .attr("src"'<%= ResolveUrl(TargetFolder) %>' + uploadedFile.FileName)  
                .load(function(e) { PageMethods.CreateThumbNail(uploadedFile.FileName); })  
                ;  
                Array.add(uploadedFiles, uploadedFile);  
                  
            }  
            //Called when all files are uploaded  
            function onClientUploadFinished() {  
                updateHiddenField();  
                var image; var deleteFile; var html="";  
                for (var i = 0; i < uploadedFiles.length; i++) {  
 
                    image = '<%= ResolveUrl(TargetFolder) %>aa_' + uploadedFiles[i].FileName  
                    html += "<img id='img_"+i.toString()+"' width='150px' src='" + image + "' /><br/>";  
                    var aa = document.getElementById("uploaded-files");  
                     
                }  
                  
                aa.innerHTML = html;  
                  
 
            }  
              
              
        </script> 
#c
protected string InitParameters  
        {  
            get 
            {  
                List<string> uploadConfig = new List<string>();  
 
                uploadConfig.Add("UploadServiceUrl=" + ResolveUrl("~/RadUploadHandler.ashx"));  
                uploadConfig.Add("TargetFolder=" + ResolveUrl(TargetFolder));  
                uploadConfig.Add("AllowedExtensions=" + "Image Files(*.gif;*.jpg;*.jpeg;*.png)");  
                uploadConfig.Add("OverwriteExistingFiles=" + true);  
                uploadConfig.Add("IsAutomaticUpload=" + true);  
                uploadConfig.Add("OnClientFileUploaded=" + "onClientFileUploaded");  
                //Name of the JavaScript function that will be called when all files are uploaded.  
                uploadConfig.Add("OnClientFilesUploadFinished=" + "onClientUploadFinished");  
                  
                return String.Join(",", uploadConfig.ToArray());  
            }  
        }  
        private void PopulateUploadedFilesList()  
        {  
            if (!string.IsNullOrEmpty(UploadedFilesJson.Value))  
            {  
                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List<UploadedFileInfo>));  
                UploadedFiles = (List<UploadedFileInfo>)serializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(UploadedFilesJson.Value)));  
                UploadedFilesJson.Value = string.Empty;  
            }  
        }  
 
        [WebMethod]  
        public static void DeleteFile(string fileName)  
        {  
            string uploadFolder = HttpContext.Current.Request.MapPath(TargetFolder);  
            File.Delete(Path.Combine(uploadFolder, fileName));  
        }  
 
        [WebMethod]  
        public static void CreateThumbNail(string fileName)  
        {              
            string uploadFolder = HttpContext.Current.Request.MapPath(TargetFolder);  
            string pathImg = Path.Combine(uploadFolder, fileName);  
            File.Copy(Path.Combine(uploadFolder, fileName), Path.Combine(uploadFolder, "aa_" +fileName));  
           //  
        } 

===
And have a problem : the upload silverlight is disable in RadWindows when using Firefox, it ok if not use in RadWindows.
===
Please view image attach
======
And would you like send to me source code of Upload Silverlight that is used at here ( the source you attached is not same that in example.) I like that used in example.

Thank you 

sohrab akhavan
Top achievements
Rank 1
 asked on 11 Apr 2010
1 answer
92 views
My RadGrid is not displayed correctly. I use the Default skin.

In Chrome the Grid is Displayed next to the command toolbar. See screenshot Chrome.jpg. When i click on one of the export buttons and the page makes a roundtrip the display is restored and everything is displayed correctly.

In IE the display is also wrong. 

Any idea's what's causing this?
Dick
Top achievements
Rank 1
 answered on 11 Apr 2010
2 answers
105 views
Hello, i think i've tried just about every option i can find to Collapse the ChildNodes of the Level==0 parent i suspect that 
is has something to do with the fact that i'm not actually using the " e " in e.Nodes.... to try and do the actual process
but i'm trying to use the actual RadTreeView ID collection itself, but the reason i'm doing that is because i want to Collapse 
all of the Level 0 AAAA node when i then select the Level 0 BBBB node for instance, so if i tried to use the " e " value
i would be pointing to the BBBB node which i what i want to expand, but before i expand it, i want to Collapse the AAAA node 
just for example. thanks for any ideas or suggestins! 

   protected void trvDB2_NodeExpand(object sender, RadTreeNodeEventArgs e)  
    {  
        foreach (RadTreeNode rtn in trvDB2.Nodes)  
        {  
            if (rtn.Level == 0 && !e.Node.Text.Equals(rtn.Text))  
            {   
                int    rntnc = rtn.Nodes.Count;  
                //Nodes   ns = rtn.Nodes.Remove();  
                //for (int index = rtn.Nodes.Count - 1; index >= 0; index--)  
                for   (int index = rtn.Nodes.Count - 1; index >= 0; index--)  
                {  
                    //string rtnrtntxt0 = rtn.Nodes[index].Text;  
                    //if (rtn.Nodes[index].Level==1)  
                    //{  
                    //    //string rtnrtntxt = rtn.Text;  
                    //    //string rntnit = rtn.Nodes[index].Text;  
                    //    rtn.Nodes.Clear();  
                    //    //rtn.Nodes[index]  
                    //    //rtn.Nodes[index];  
                    //    //rtn.Nodes  
                    //}  
                }  
                //string x = rtn.Text;  
                //IEnumerator ie =  rtn.Nodes.GetEnumerator();  
                //while (ie.MoveNext())  
                //{  
                //    ((RadTreeNode)(ie.Current)).Nodes.Clear();  
                //}  
                //foreach (RadTreeNode rtn2 in rtn.Nodes)  
                //{  
                //     //string r = rtn 
                //     //rtn2.Nodes.Clear();  
                //     //rtn2.c  
                //     //rtn2.Nodes.Clear();  
                //     //rtn.Nodes.Remove(rtn2);  
                //}  
                //rtn.Nodes.Remove();  
                //rtn.CollapseChildNodes();  
                //rtn.CollapseParentNodes();  
            }  
        }  
        for (int index = trvDB2.CheckedNodes.Count - 1; index >= 0; index--)  
        {  
            //trvDB2.CheckedNodes[index].Checked = false;  
        }  
        for (int index = trvDB2.Nodes.Count - 1; index >= 0; index--)  
        {  
            string trvnodetxt = trvDB2.Nodes[index].Text;  
            if (trvDB2.Nodes[index].Level == 0 && !e.Node.Text.Equals(trvnodetxt))  
               {  
                   trvDB2.Nodes[index].CollapseChildNodes();  
                   trvDB2.Nodes[index].Nodes.Clear();  
                   trvDB2.Nodes[index].Remove();  
               }  
        }  
        //e.Node.CollapseChildNodes();  
        //e.Node.CollapseParentNodes();  
        //PopulateNodeOnDemand(e, TreeNodeExpandMode.ServerSideCallBack);  
    } 
Bob
Top achievements
Rank 1
 answered on 11 Apr 2010
6 answers
333 views
Hi All,
I have the scheduler setup to use an 

Telerik.Web.UI.XmlSchedulerProvider

 

to look after its bookings/appointments.  This works well in that the provider handles all the inserts/updates/deletes for me.
I do, however, have a need to send a notification email to the Admin when new appointments get inserted or updated.  In this email I want to provide a link to the scheduler, passing the appointment ID in the QueryString so that the appointment in question can be highlighted.  This all works great for updates, as the ID is available in the 

 

RadScheduler1_AppointmentUpdate

Method in the e.Appointment.ID property.
The same cannot be said for 

 

RadScheduler1_AppointmentInsert

 

as the ID is null - I suppose the insert of the xmlProvider has not happened yet.

So my question is, at what point/event can I obtain the ID of the newly created Appointment?

Thanks for any help.
Steele.

Zheng Gong
Top achievements
Rank 1
 answered on 10 Apr 2010
1 answer
86 views
Hi, i have a very simple plot chart. The query returns a date and a int value.

When the int value exceeds a predetermined amount i want the point color red
If it's not possible to have different colors depending on a value, is it possible to have a red grid line at a given value.

Thanks
Rod
Rod Barrand
Top achievements
Rank 1
 answered on 10 Apr 2010
0 answers
142 views

Hello,

When I create nodes I have a problem. I have a list:

e.g.:



class Liste  
{  
    public string pfad;  
    public Liste(string pfad)  
    {  
        this.pfad = pfad;  
    }  
}  
 
....  
 
if (!IsPostBack)  
{  
    LadeWerte();  
    ZeigeTreeView();  
}  
 
.....  
 
private void LadeWerte()  
{  
liste.Add(new Liste("c:\\dateien\\nord\\stad_nord"));  
liste.Add(new Liste("c:\\dateien\\stad_test"));  
liste.Add(new Liste("c:\\dateien\\nord\\stad_sued"));  
}  
 
 

From this list, I create nodes. Here is my code:

private void ZeigeTreeView()  
    {  
        RadTreeNode rtn = new RadTreeNode("Layouts""rootfolder");  
 
        foreach (Liste list in liste)  
        {  
            Rekursiv(rtn, list.pfad);              
        }  
 
        RadTreeView1.Nodes.Add(rtn);  
    }  
 
    private void Rekursiv(RadTreeNode node, string newnode)  
    {  
        if (newnode != "")  
        {  
            RadTreeNode rtn2 = new RadTreeNode();  
            string substr = "";  
            if (newnode.LastIndexOf("\\") > 0)  
                substr = newnode.Substring(0, newnode.IndexOf("\\"));  
            else 
                substr = newnode;  
            rtn2.Text = substr;  
            rtn2.Value = "Folder";  
            string nextnode = "";  
            if (newnode.IndexOf("\\") > 0)  
            {  
                nextnode = newnode.Substring(newnode.IndexOf("\\") + 1);  
                Rekursiv(rtn2, nextnode);  
            }  
            node.Nodes.Add(rtn2);  
        }  
    } 

I get the following structure:

+Layouts
    +c:
        +dateien
            +nord
                -stadt_nord
    +c:
        +dateien
            -stad_test
    +c:
        +dateien
            +nord
                -stad_sued

However, I want the following structure:

+Layouts
    +c:
        +dateien
        -stad_test
        +nord
            -stad_nord
            -stad_sued

Can you help me here? Nodes that should already exist are not created again. How can I do that.

Thanks

Reiner
Reiner Ebel
Top achievements
Rank 1
 asked on 10 Apr 2010
12 answers
361 views

Hello,

Our online version of RadEditor is 7.3.2 – RadEditor for ASP .NET

While attempting to migrate to the RadEditor for ASP .NET AJAX we’ve came across these problems:

1.       We’re interested in having the editor strip HTML tags (except for BR tags) when the user pastes content into it. Since the stripping is problematic in FF, we’ve written some client code to bring the “paste plain text page” up when the user tries to paste. This is the code we have online:

function OnClientCommandExecuting(editor, commandName, oTool)          

{

    var browserName=navigator.appName;           

    if (commandName == "Paste" && browserName!="Microsoft Internet Explorer")          

    {      

        editor.Fire("PastePlainText");       

        return false;          

    }              

}

We’ve changed it to fit the new version thus:

function OnClientCommandExecuting(editor, commandName, oTool)          

{

    var browserName=navigator.appName;           

    if (commandName._commandName == 'Paste' && browserName!="Microsoft Internet Explorer")          

    {      

        editor.fire("PastePlainText");       

        return false;          

    }              

}

Which works, but the behavior is different! Instead of bringing up the “paste plain text page”, the editor first puts the clipboard’s content in the content-area of the editor, and only then brings the page up, thereby rendering our efforts useless.
Please advise as to what we can do to solve this problem ?

2.       Another problem is, when the user clicks the “paste” button, the “Please use Ctrl+V to Paste” msgbox appears before the “paste plain text page” appears.
How do we suppress this in the new (AJAX) version ?

Chase Florell
Top achievements
Rank 1
 answered on 09 Apr 2010
1 answer
70 views
Hi
I am using the Telerik controls under Mono and have a page with a grid. In the Q3/2009 version everything worked fine. With the Q1/2010 version I get a strange error.
Heres's the error message:

'GridDataTypeConverter' is unable to convert 'System.MonoType' to 'System.ComponentModel.Design.Serialization.InstanceDescriptor'.

Description: HTTP 500. Error processing request.

Stack Trace:

System.NotSupportedException: 'GridDataTypeConverter' is unable to convert 'System.MonoType' to 'System.ComponentModel.Design.Serialization.InstanceDescriptor'.
  at System.ComponentModel.TypeConverter.GetConvertToException (System.Object value, System.Type destinationType) [0x00000]
  at System.ComponentModel.TypeConverter.ConvertTo (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value, System.Type destinationType) [0x00000]
  at Telerik.Web.UI.GridDataTypeConverter.ConvertTo (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value, System.Type destinationType) [0x00000]
  at System.ComponentModel.TypeConverter.ConvertTo (System.Object value, System.Type destinationType) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.GetExpressionFromString (System.Type type, System.String str, System.Reflection.MemberInfo member) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.AddCodeForPropertyOrField (System.Web.UI.ControlBuilder builder, System.Type type, System.String var_name, System.String att, System.Reflection.MemberInfo member, Boolean isDataBound, Boolean isExpression) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.ProcessPropertiesAndFields (System.Web.UI.ControlBuilder builder, System.Reflection.MemberInfo member, System.String id, System.String attValue, System.String prefix) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateAssignStatementFromAttribute (System.Web.UI.ControlBuilder builder, System.String id) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateAssignStatementsFromAttributes (System.Web.UI.ControlBuilder builder) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateControlTree (System.Web.UI.ControlBuilder builder, Boolean inTemplate, Boolean childrenAsProperties) [0x00000]
  at System.Web.Compilation.TemplateControlCompiler.CreateMethods () [0x00000]
  at System.Web.Compilation.PageCompiler.CreateMethods () [0x00000]
  at System.Web.Compilation.BaseCompiler.ConstructType () [0x00000]
  at System.Web.Compilation.GenericBuildProvider`1[TParser].GenerateCode () [0x00000]
  at System.Web.Compilation.BuildManager+BuildItem.GenerateCode () [0x00000]

Version information: Mono Version: 2.0.50727.1433; ASP.NET Version: 2.0.50727.1433

I use the Mono version 2.4.2.3. Are there any limitations for the new Telerikm version or do you have any suggestions what to do next?

Best regards.
Ferdinand
Daniel
Telerik team
 answered on 09 Apr 2010
2 answers
127 views
i have a grid as below:
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" Width="828px" OnNeedDataSource="RadGrid1_NeedDataSource" 
        OnUpdateCommand="RadGrid1_UpdateCommand" EnableAjaxSkinRendering="true" Skin="Default" 
        OnInsertCommand="RadGrid1_InsertCommand"
        <MasterTableView DataKeyNames="ProductID" GridLines="None" Width="100%" CommandItemDisplay="Top"
            <Columns> 
                <telerik:GridTemplateColumn HeaderText="Prod.Image" UniqueName="ProductImage"
                    <ItemTemplate> 
                        <asp:Image ID="Image1" ImageUrl='<%# Link.ToProductThumbNail(Eval("Thumbnail").ToString()) %>' 
                            runat="server" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridTemplateColumn HeaderText="Prod. Number" UniqueName="ProductNoImage"
                    <ItemTemplate> 
                        <asp:Image ID="Image2" ImageUrl='<%# Link.ToProductNo(Eval("ProductNo").ToString()) %>' 
                            runat="server" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="Name" HeaderText="Prod.Name" UniqueName="ProdName"
                </telerik:GridBoundColumn> 
                <telerik:GridHTMLEditorColumn DataField="Description" HeaderText="Prod.Desc" UniqueName="ProdDescription"
                </telerik:GridHTMLEditorColumn> 
<%--                <telerik:GridBoundColumn DataField="Description" HeaderText="Prod.Desc" UniqueName="ProdDescription"
                </telerik:GridBoundColumn>--%> 
                <telerik:GridBoundColumn DataField="Price" HeaderText="Price" DataFormatString="{0:£0.00}" 
                    UniqueName="ProdPrice"
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn UniqueName="SelectProd"
                    <ItemTemplate> 
                        <asp:HyperLink ID="HyperLink1" runat="server" Text="Select" NavigateUrl='<%# "ProductDetail.aspx?CategoryID=" +  
                                                                                                      Request.QueryString["CategoryID"] +  
                                                                                                      "&amp;ProductIDProductID=" + Eval("ProductID") %>'> 
                        </asp:HyperLink> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridCheckBoxColumn Visible="false" DataField="PromoFront" HeaderText="Cat.Promo" 
                    UniqueName="PromoFront"
                </telerik:GridCheckBoxColumn> 
                <telerik:GridCheckBoxColumn Visible="false" DataField="PromoDept" HeaderText="Dept.Promo" 
                    UniqueName="PromoDept"
                </telerik:GridCheckBoxColumn> 
                <telerik:GridEditCommandColumn> 
                </telerik:GridEditCommandColumn> 
            </Columns> 
            <EditFormSettings ColumnNumber="2" CaptionFormatString="Edit details for:{0}" CaptionDataField="Name"
                <FormTableItemStyle Wrap="False"></FormTableItemStyle> 
                <FormCaptionStyle></FormCaptionStyle
                <FormMainTableStyle CellSpacing="0" CellPadding="3" Width="100%" /> 
                <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" Height="110px" 
                    Width="100%" /> 
                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle> 
                <FormStyle Width="100%" BackColor="#EEF2EA"></FormStyle> 
                <EditColumn UpdateText="Update" UniqueName="EditCommandColumn1" CancelText="Cancel"
                </EditColumn> 
                <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle> 
            </EditFormSettings> 
            <ExpandCollapseColumn Visible="False"
                <HeaderStyle Width="19px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            <RowIndicatorColumn Visible="False"
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
        </MasterTableView> 
    </telerik:RadGrid> 
with the following code behind to save the data to the dabase:
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e) 
    { 
        //Get the GridEditableItem of the RadGrid      
        GridEditableItem editedItem = e.Item as GridEditableItem; 
         
 
        //Get the primary key value using the DataKeyValue.      
        string id = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ProductID"].ToString(); 
         
        //Access the textbox from the edit form template and store the values in string variables. 
        //string productno = (editedItem["ProductNo"].Controls[0] as TextBox).Text; 
        string name = (editedItem["ProdName"].Controls[0] as TextBox).Text; 
        string description = (editedItem["ProdDescription"].Controls[0] as GridHTMLEditorColumnEditor).Text; 
        string price = (editedItem["ProdPrice"].Controls[0] as TextBox).Text; 
        //string thumbnail = (editedItem["ProdThumbnail"].Controls[0] as TextBox).Text; 
        //string image = (editedItem["ProdImage"].Controls[0] as TextBox).Text; 
        string promoDept = (editedItem["PromoDept"].Controls[0] as CheckBox).Checked.ToString(); 
        string promoFront = (editedItem["PromoFront"].Controls[0] as CheckBox).Checked.ToString(); 
 
 
        try 
        { 
            CatalogAccess.UpdateProduct(id,name,description.ToString(),price,promoDept, promoFront); 
 
        } 
        catch (Exception ex) 
        { 
            RadGrid1.Controls.Add(new LiteralControl("Unable to update Category. Reason: " + ex.Message)); 
            e.Canceled = true
        } 
    } 
I keep getting the error on line 53
 Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. 
 
Source Error: 
 
Line 51:         //string productno = (editedItem["ProductNo"].Controls[0] as TextBox).Text; 
Line 52:         string name = (editedItem["ProdName"].Controls[0] as TextBox).Text; 
Line 53:         string description = (editedItem["ProdDescription"].Controls[0] as GridHTMLEditorColumnEditor).Text; 
Line 54:         string price = (editedItem["ProdPrice"].Controls[0] as TextBox).Text; 
Line 55:         //string thumbnail = (editedItem["ProdThumbnail"].Controls[0] as TextBox).Text; 
I would really appreciate a solution.  I am sure I am almost there but not quite working.

Simon
Simon
Top achievements
Rank 1
 answered on 09 Apr 2010
9 answers
723 views
I'm struggling to find the right way to do this.

I have a user control with a RadGrid and an Edit button in it.  Clicking the Edit button retrieves the primary key for the selected row within the RadGrid and opens a RadWindow passing the primary key to the page opened in the window using a Query String.

Then I have a javascript routine that handles the Window close and does a Rebind on the RadGrid to refresh it with the latest values.  I use the argument from the Window to get the primary key again and select the corresponding row in the RadGrid.  This is done by calling 

var

ajaxManager = $find("<%= this.Page.AjaxManager.ClientID %>");
ajaxManager.ajaxRequestWithTarget('<%= Button_EditEntry.UniqueID %>', oWnd.argument);

The trouble is, this works fine within a page, but within a UserControl I seem to be faced with a dilema:

To retrieve the argument passed in the Ajax Request, I have to implement a RaisePostBackEvent method in my code-behind.  For a page, this is a simple matter of overriding the page's implementation of this.  For a UserControl, I have to implement IPostBackEventHandler.  According to the documentation, to ensure that my RaisePostBackEvent function gets called, I have to call ajaxRequestWithTarget using the UniqueID of the UserControl itself instead of the button, but if I do that, all the controls within the UserControl get updated during the Ajax Request instead of just those controls that Button_EditEntry should affect.

Within a UserControl, how can I initiate an Ajax call on the client side, retrieve the argument on the server side, and limit the controls that are updated to one or two instead of the entire UserControl?

Jeff

Rebecca Campbell
Top achievements
Rank 1
 answered on 09 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?