Button Click Event with Button Inside DIV

Thread is closed for posting
4 posts, 0 answers
  1. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 19 Nov 2008 Link to this post

    I am using this script to put a Button INSIDE the Upload Div.

     
    <script type="text/javascript">  
    function pageLoad()  
    {  
       var upload = $find("<%= RadUpload1.ClientID %>");     
       var uploadDiv = upload.get_element();  
         
       var input = document.createElement("input");  
       input.type = "submit";  
       input.className = "ruButton";  
       input.value = "Upload My XML Now";  
       input.id = input.name = upload.getID("submit");  
         
       //the UL element of the upload  
       var ul = uploadDiv.getElementsByTagName("UL");  
       //the array of all LI elements of the UL element  
       var LIs = ul[0].getElementsByTagName("LI");  
       //Last LI item - the button area  
       var lastLi = LIs[LIs.length - 1];  
       lastLi.appendChild(input);     
    }  
    </script>   
     

    The file is being uploaded properly, however I need to be able to rename the file when it is uploaded as well as store the file path in the database.

    How do I do a Button_Click event when using this JavaScript created button?
  2. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 19 Nov 2008 Link to this post

    also, i tried the code shown in THIS THREAD but it is not working...

    Imports System  
    Imports System.Data  
    Imports System.Configuration  
    Imports System.Collections  
    Imports System.Web  
    Imports System.Web.Security  
    Imports System.Web.UI  
    Imports System.Web.UI.WebControls  
    Imports System.Web.UI.WebControls.WebParts  
    Imports System.Web.UI.HtmlControls  
    Imports Telerik.Web.UI  
    Imports Telerik.Web.UI.Upload  
     
    Partial Class App_Controls_Admin_BizForSale_ValueProUploader  
        Inherits System.Web.UI.UserControl  
     
        Protected Sub Page_Load(ByVal sender As ObjectByVal e As EventArgs)  
            If Request.Params("__EVENTTARGET") = "submitButton" Then 
                submitButton_Click()  
            End If 
        End Sub 
        Protected Sub submitButton_Click()  
            Response.Write("submitButton_Click event fired")  
        End Sub 
     
    End Class 
     

                    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" /> 
                    <telerik:RadUpload ID="RadUpload1"   
                                       runat="server"   
                                       Skin="Default2006"   
                                       TargetFolder="~/App_Data/ValuePro"   
                                       AllowedFileExtensions=".xml"   
                                       Width="430px">  
                                       <Localization Select="Browse..." Add="Add Another" Delete="Remove Selected"   /> 
                                       </telerik:RadUpload> 
     
                    <telerik:RadProgressArea ID="RadProgressArea1" ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, TimeElapsed, TimeEstimated, TransferSpeed" runat="server"   
                        Skin="Default2006" /> 
     
     <script type="text/javascript">  
        function pageLoad() {  
            var upload = $find("<%= RadUpload1.ClientID %>");  
            var uploaduploadDiv = upload.get_element();  
     
            var input = document.createElement("input");  
            input.type = "submit";  
            input.className = "ruButton";  
            input.value = "Submit";  
            inputinput.id = input.name = upload.getID("submitButton");  
            input.onclick = onClickHandler;  
     
            //the UL element of the upload  
            var ul = uploadDiv.getElementsByTagName("UL");  
            //the array of all LI elements of the UL element  
            var LIs = ul[0].getElementsByTagName("LI");  
            //Last LI item - the button area  
            var lastLi = LIs[LIs.length - 1];  
            lastLi.appendChild(input);  
        }  
     
        function onClickHandler() {  
            __doPostBack("submitButton", "");  
        }  
    </script>   
     

    Thanks in advance.
  3. Chase Florell
    Chase Florell avatar
    257 posts
    Member since:
    Apr 2005

    Posted 19 Nov 2008 Link to this post

    Never Mind, it is working... the Response.Write was not working because my Page_Load was wrong... didn't use Handles Me.Load

        Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
            If Request.Params("__EVENTTARGET") = "submitButton" Then 
                submitButton_Click()  
            End If 
        End Sub 
  4. Arni
    Arni avatar
    17 posts
    Member since:
    Oct 2008

    Posted 13 Dec 2008 Link to this post

    hi,
     I am Using Rad upload dynamicaly binding Image
    i m using rad tool bar button to edit ,delete, edit .. the radupload files..
    the pblm is..
    rad upload is working if i set.. normal button click...
    but  postback pblm when i call OnclientButton clicking in rad toolbar event.
     in have to keep the rad upload within updatepanel..i set trrigers to buton idto radtoolbarid..
    kindly any one help me.. to clear this pblm..
Back to Top