I've got a GridBinaryImageColumn in my radgrid. I've got ajax enabled. I've got the javascript to do the disabling for image uploads (args.set_enableAjax(false);). I'm getting the database populated. I'm actually getting data back (binary) when the grid is displayed. HOWEVER, it's never displaying an image. I get a broken image tag because there is no src attribute ever added.
Can someone give me a place to troubleshoot, because I've been through about all I know. Looked into the db, used sql profiler to see what's coming in/out.... just no good. Am I missing something obvious?
My column:
<telerik:GridBinaryImageColumn DataField="Photo" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description"
DataAlternateTextFormatString="Image of {0}">
<HeaderStyle Width="10%" />
Insert (this is working, data goes to db)
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
RadUpload uplPhoto = (RadUpload)e.Item.FindControl("uplPhoto");
foreach (UploadedFile file in uplPhoto.UploadedFiles)
{
byte[] bytes = new byte[file.InputStream.Length];
file.InputStream.Read(bytes, 0, (int)file.InputStream.Length);
SPPDataContext data = new SPPDataContext();
Gallery gal = new Gallery();
gal.Photographer = (Guid)Membership.GetUser().ProviderUserKey;
gal.Name = ((RadTextBox)e.Item.FindControl("txtPhotoName")).Text;
gal.Description = ((RadTextBox)e.Item.FindControl("txtPhotoName")).Text;
gal.Photo = bytes;
data.Galleries.InsertOnSubmit(gal);
data.SubmitChanges();
}
}
Pulling data by linqdatasource:
<asp:LinqDataSource ID="ldsPortfolioGrid" runat="server"
ContextTypeName="SPP.Web.Data.SPPDataContext" OrderBy="Name"
TableName="Galleries" Where="Photographer == @Photographer"
onselecting="ldsPortfolioGrid_Selecting" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" oninserted="ldsPortfolioGrid_Inserted"
oninserting="ldsPortfolioGrid_Inserting">
<WhereParameters>
<asp:Parameter DbType="Guid" Name="Photographer" />
</WhereParameters>
</asp:LinqDataSource>
Selecting is doing nothing exciting either:
protected void ldsPortfolioGrid_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
e.WhereParameters["Photographer"] = Membership.GetUser().ProviderUserKey;
}
Thanks in advance guys!
Can someone give me a place to troubleshoot, because I've been through about all I know. Looked into the db, used sql profiler to see what's coming in/out.... just no good. Am I missing something obvious?
My column:
<telerik:GridBinaryImageColumn DataField="Photo" HeaderText="Image" UniqueName="Upload" ImageAlign="NotSet"
ImageHeight="80px" ImageWidth="80px" ResizeMode="Fit" DataAlternateTextField="Description"
DataAlternateTextFormatString="Image of {0}">
<HeaderStyle Width="10%" />
Insert (this is working, data goes to db)
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
RadUpload uplPhoto = (RadUpload)e.Item.FindControl("uplPhoto");
foreach (UploadedFile file in uplPhoto.UploadedFiles)
{
byte[] bytes = new byte[file.InputStream.Length];
file.InputStream.Read(bytes, 0, (int)file.InputStream.Length);
SPPDataContext data = new SPPDataContext();
Gallery gal = new Gallery();
gal.Photographer = (Guid)Membership.GetUser().ProviderUserKey;
gal.Name = ((RadTextBox)e.Item.FindControl("txtPhotoName")).Text;
gal.Description = ((RadTextBox)e.Item.FindControl("txtPhotoName")).Text;
gal.Photo = bytes;
data.Galleries.InsertOnSubmit(gal);
data.SubmitChanges();
}
}
Pulling data by linqdatasource:
<asp:LinqDataSource ID="ldsPortfolioGrid" runat="server"
ContextTypeName="SPP.Web.Data.SPPDataContext" OrderBy="Name"
TableName="Galleries" Where="Photographer == @Photographer"
onselecting="ldsPortfolioGrid_Selecting" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" oninserted="ldsPortfolioGrid_Inserted"
oninserting="ldsPortfolioGrid_Inserting">
<WhereParameters>
<asp:Parameter DbType="Guid" Name="Photographer" />
</WhereParameters>
</asp:LinqDataSource>
Selecting is doing nothing exciting either:
protected void ldsPortfolioGrid_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
e.WhereParameters["Photographer"] = Membership.GetUser().ProviderUserKey;
}
Thanks in advance guys!