Hi again,
I'm trying to dynamically set the text of the "Add File" button in the <UplevelSelectorTemplate>. The reason for this is our website is bilingual, and I need to dynamically change the text to another language based on the culture instead of having the button's text hard-coded.
I've tried using FindControl within the ItemTemplateCreated method, but the button can't be found (likely because it's not in the template?)
My code is below. I am trying to set the text for btnAddFile
Something like this:
Dim btnAddFile As Button = DirectCast(e.Item.FindControl("btnAddFile"), Button)
If clsCulture.CurrentCulture = clsUtil.AvailableLanguages.fr Then
btnAddFile.Text = "Ajouter un fichier"
Else
btnAddFile.Text = "Add File"
End If
I also need to do this for controls inside the <ProgressTemplate> as well (ie: label control for "Uploading", "(calculating"), "currently uploading", etc). I need create this text as labels and translate the text depending on the culture.
My markup code... thank you:
<kw:SlickUpload ID="SlickUpload1" runat="server" ShowDuringUploadElements="cancelButton" MaxFiles="1" HasPostProcessStep="True" HideDuringUploadElements="cmdUpload" ValidExtensions="" OnUploadComplete="SlickUpload1_UploadComplete" AutoPostBackAfterUpload="true" >
<DownlevelSelectorTemplate>
<input type="file" id="fuFile" />
</DownlevelSelectorTemplate>
<UplevelSelectorTemplate>
<!-- NEED TO ACCESS THIS BUTTON-->
<asp:Button ID="btnAddFile" runat="server" Text="Add File" />
</UplevelSelectorTemplate>
<FileTemplate>
<kw:FileListRemoveLink ID="FileListRemoveLink1" runat="server">[X]</kw:FileListRemoveLink>
<kw:FileListFileName ID="FileListFileName1" runat="server" />
<kw:FileListValidationMessage ID="FileListValidationMessage1" runat="server" ForeColor="Red" />
</FileTemplate>
<ProgressTemplate>
<table width="100%">
<tr>
<td>
<!--NEED TO ACCESS THIS LABEL -->
<asp:label id="lblUploading" runat="server" text="Uploading" />
<kw:UploadProgressElement ID="UploadProgressElement1" runat="server" Element="FileCountText">
</kw:UploadProgressElement>
,
<kw:UploadProgressElement ID="UploadProgressElement2" runat="server" Element="ContentLengthText">
(calculating)</kw:UploadProgressElement>
.
</td>
</tr>
{...}
</ProgressTemplate>
</kw:SlickUpload>