TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bineeshcp Viswanath
NA
140
39.4k
System.Byte[] showing in Gridview Column in ASP.NET C#
Apr 12 2019 2:49 AM
Hi All,
I am facing a discrepancy in loading image into gridview column in asp.net using c#.
My gridview has action with/without images. Action with images showing System.Byte[]. Please find screenshot below.
I don't want to show System.Byte[] in the column. I already wrote a .css class to assign a icon to that column control. That image is displaying . I need your help to remove System.Byte[] and only to show that icon.
Here is my table where store image:-
SQL stored procedure i using to bind the gridview
SELECT
tblActionDetaills.FID,tblVilla.VillaName,tblActionDetaills.VID,tblActionDetaills.AdminUserID,
tblImageDetails.Image,
Convert
(
varchar
(20),EventDate,103)
as
EventDate,
REPLACE
(
SUBSTRING
(
CONVERT
(nvarchar(128),EventDate, 109), 12 , 128),
':000'
,
' '
)
as
EventTime,
Description,Comment
FROM
tblActionDetaills
inner
join
tblVilla
on
tblVilla.VID=tblActionDetaills.VID
inner
join
tblUserLogin
on
tblUserLogin.UserID=tblVilla.UserID
left
join
tblImageDetails
on
tblImageDetails.FID=tblActionDetaills.FID
WHERE
tblUserLogin.UserID=@UserID
order
by
Convert
(datetime,EventDate,103)
desc
.aspx code where binding in gridview
<
asp:TemplateField
ItemStyle-HorizontalAlign
=
"Left"
HeaderText
=
"View Image"
HeaderStyle-HorizontalAlign
=
"Center"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"LinkButton1"
CssClass
=
"lnkbtnSelect"
CommandName
=
"LoadImage"
Text
=
'<% # Eval("Image")%>'
CommandArgument
=
'<%#Eval("FID")%>'
runat
=
"server"
>
View Image
</
asp:LinkButton
>
</
ItemTemplate
>
</
asp:TemplateField
>
And C# code where I wrote to bind gridview
using
(SqlDataAdapter adapter =
new
SqlDataAdapter(
"LoadVillaDetailsForGridForCustomer"
, clsConObj.sqlCon))
{
adapter.SelectCommand.Parameters.Add(
"@UserID"
, SqlDbType.SmallInt).Value = Session[
"UserID"
].ToString();
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
DataTable dtbl =
new
DataTable();
adapter.Fill(dtbl);
{
grdConstructionDetails.DataSource = dtbl;
grdConstructionDetails.DataBind();
grdConstructionDetails.HeaderRow.TableSection = TableRowSection.TableHeader;
//added by sai on 09/04/2019 for lbl
lblTotalRecords.Text = Convert.ToInt16(dtbl.Rows.Count).ToString();
}
}
Reply
Answers (
10
)
Dropdown Required and Display attribute not working
On click how to open crystal report