This is a migrated thread and some comments may be shown as answers.

Button Click Event with Button Inside DIV

3 Answers 189 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Chase Florell
Top achievements
Rank 1
Chase Florell asked on 20 Nov 2008, 12:28 AM
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?

3 Answers, 1 is accepted

Sort by
0
Chase Florell
Top achievements
Rank 1
answered on 20 Nov 2008, 01:16 AM
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.
0
Chase Florell
Top achievements
Rank 1
answered on 20 Nov 2008, 01:33 AM
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 
0
Arni
Top achievements
Rank 1
answered on 13 Dec 2008, 02:39 PM
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..
Tags
Upload (Obsolete)
Asked by
Chase Florell
Top achievements
Rank 1
Answers by
Chase Florell
Top achievements
Rank 1
Arni
Top achievements
Rank 1
Share this question
or