在gridview中显示varbinary数据 [英] displaying varbinary data in a gridview

查看:97
本文介绍了在gridview中显示varbinary数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在gridview中显示varbinary数据作为图像或pdf或rar或docx ..

i想要从db下载显示链接

解决方案

< blockquote> Yous应该在该gridview列中添加一个图像按钮,该按钮与动作ManageFileLink链接,用于通过使用Java脚本下载和/或打开文件,如下所示:



protected void _contactsGridView_RowDataBound(object sender,GridViewRowEventArgs e)

{

if(e.Row.RowIndex< 0)

返回;

//

DataRow dataRow =((DataRowView)e.Row.DataItem).Row;

int yourDataID = (int)dataRow [ID];

//

ImageButton fileLinkBut​​ton =(ImageButton)e.Row.FindControl(_ fileLinkBut​​ton);

fileLinkBut​​ton.Attributes.Add(onClick,ManageFileLink(''+ yourDataID +''); return false;);



}

how displaying varbinary data as images or pdf or rar or docx ..in a gridview
i want show link for download from db

解决方案

Yous should add for example an image button in that gridview column, that is linked with the action "ManageFileLink" for downloading and/oropenening the file by using Java Script like in in thext example:

protected void _contactsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex < 0)
return;
//
DataRow dataRow = ((DataRowView)e.Row.DataItem).Row;
int yourDataID = (int)dataRow["ID"];
//
ImageButton fileLinkButton = (ImageButton)e.Row.FindControl("_fileLinkButton");
fileLinkButton.Attributes.Add("onClick", "ManageFileLink(''" + yourDataID + "'');return false;");

}


这篇关于在gridview中显示varbinary数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆