dat grid error with javascript

Hi,

I am using  ajax controol tool file upload to uplaod an image and then populate that image in a datagrid.

However what happens if it is the first time that I am uploading something then I get an error
"Unhandled Exception 'dlV' is undefined"

I am assuming this is because it can not find the datagrid

Code below

Please help

R8VI
<script type="text/javascript" language="javascript">
        function UploadComplete(sender, args) {

            var fileupload = document.getElementById("asyncFileUpload1");
            if (fileupload != null) {
                document.getElementById("asyncFileUpload1").outerHTML = fileupload.outerHTML;

            }

            document.getElementById('lblStatus').innerText = 'Uploading Completed.';
            __doPostBack(dlV);
            


        }
</Script>

aspx page
               <cc1:AsyncFileUpload ID="asyncFileUpload1" runat="server" UploadingBackColor="LightGray"
                    CompleteBackColor="Lime" OnUploadedComplete="asyncUploadComplere" UploaderStyle="Modern"
                    ThrobberID="Throbber" OnClientUploadComplete="UploadComplete" OnClientUploadStarted="StartUpload"
                    Width="300px" />

            <div class="gallery">
                <asp:DataList ID="dlV" runat="server" RepeatColumns="4" RepeatDirection="Horizontal"
                   Visible="true">
                    <ItemTemplate>
                        
                    </ItemTemplate>
                </asp:DataList>
            </div>

Open in new window

R8VIAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
masterpassConnect With a Mentor Commented:
modify the script like this
document.getElementById('lblStatus').innerText = 'Uploading Completed.';
var datGrid = document.getElementById('<%=dlV.ClientID %>');
            __doPostBack(datGrid,'');

Open in new window

0
 
HainKurtSr. System AnalystCommented:
try

__doPostBack(<%=dlV.ClientId%>);
0
 
R8VIAuthor Commented:
HI masterpass,

I now get error
A run time error has occured
Error: sys.invalidoperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method

Please Help

Thanks,

R8vi
0
 
masterpassCommented:
How do you bind data to the Datalist ? Is that a button which will populate the datalist to be databinded ?
0
 
R8VIAuthor Commented:
soory my fault not realeted to what ypu helped me with
0
All Courses

From novice to tech pro — start learning today.