Hi,
I have a form for news.
I have a datagrid showing all news with select buttons, when it clicked, it open a detailsView with more detail.
In the database, my NewsTable has a field named File1, that contain the ID of a file (using the File table of DNN)
In the Insert mode of my DetailsView, I added the URLCONTROL, it works fine when I'm inserting and uploading new file.
But when I'm in EDIT mode, I want the 2 DropDownList (folder and file) to have their selected value to the fileID of the database... and it not working...
I don't know in wich event to put my code, and I'm not very sure how to acces the dropDownList...
Here is my code:
ASCX:
<EditItemTemplate>
<dnn:url id="ul_file" runat="server" width="325" ShowUrls="False" ShowUpload="True" showfiles="True" ShowTabs="False" ShowLog="False" ShowTrack="False" Required="False" ></dnn:url>
<%#setDropList(DataBinder.Eval(Container.DataItem, "File1"))%>
</EditItemTemplate>
VB:
Function setDropList(ByVal iFileId As Integer) As String
If (iFileId = -1) Then
Return ""
Else
Dim objFileController As New FileController
Dim objFileInfo As DotNetNuke.Services.FileSystem.FileInfo
objFileInfo = objFileController.GetFileById(iFileId, PortalId)
If Not objFileInfo.Folder = "" Then
'DirectCast(DetailsView.FindControl("ul_file").FindControl("cboFolders"), DropDownList).SelectedValue = objFileInfo.Folder 'Got an ERROR
End If
DirectCast(DetailsView.FindControl("ul_file").FindControl("cboFiles"), DropDownList).SelectedValue = iFileId 'This is working
End If
Return ""
End Function
I created the function setDropList because I didn't know in wich event to put my code...
Somebody knows the best way to do that?