I would appreciate it if someone could point me in the right direction to solve my issue.
I have a radgrid that has returns all the media such as audio, video and other media etc associated with it that particular message. Then on edit I have a dropdown whose data source populates the dropdown with all the possible audio files. Now on edit if there was a audio file chosen, it will be displayed in the dropdown and the selected value is a guid.
My issue is that IF the audiofile gets deleted before it is removed from the message, it breaks. I want to verify that the audio file still exists. Hope it all makes sense.
<
telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1" DataSourceID="SqlDataSource1"
AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" runat="server"
Skin="Telerik" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" PageSize="10"
AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated" OnItemDeleted="RadGrid1_ItemDeleted"
OnItemInserted="RadGrid1_ItemInserted" ShowStatusBar="true" Width="600px" OnItemCommand="RadGrid1_ItemCommand">
<PagerStyle Mode="NextPrevAndNumeric" />
<GroupingSettings CaseSensitive="false" />
<MasterTableView TableLayout="Fixed" DataKeyNames="episodeGuid" CommandItemDisplay="TopAndBottom">
<Columns>
<telerik:GridEditCommandColumn HeaderStyle-Width="40px" FilterControlWidth="30px"
ButtonType="ImageButton" UniqueName="EditCommandColumn">
<ItemStyle CssClass="MyImageButton" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn SortExpression="messageGuid" HeaderText="messageGuid" DataField="messageGuid"
UniqueName="messageGuid" Visible="false" ReadOnly="true">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="episodeTitle" HeaderText="title" DataField="episodeTitle">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="date" HeaderText="date" DataField="date">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ConfirmText="Delete this record?" ConfirmDialogType="RadWindow"
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
UniqueName="DeleteColumn">
<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings ColumnNumber="1" CaptionDataField="Epsiode" CaptionFormatString="Edit properties ministry {0}"EditFormType="Template">
<FormTemplate><table cellpadding="5" cellspacing="0" border="0"><
tr><td class="formFieldNameGeneric">Episode Video File</td><td class="formField"><asp:DropDownList ID="dlVideos" runat="server" DataTextField="videoTitle" DataValueField="videoGuid"SelectedValue='<%# Bind( "videoGuid") %>' AppendDataBoundItems="true" CssClass="DropDown"DataSourceID="SqlDataSource2"><asp:ListItem Text="None" Value=""></asp:ListItem></asp:DropDownList></td></tr>
I was thinking something along these lines but I could never get it to work
protected
void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
GridEditCommandColumn
editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
try
{
//If the file exists then bind it to the dropdown
}
catch
{
//The file was deleted. Selected value is now NULL.
}
}
Thanks for the help!!!