在c#中的表格单元格中显示图像 [英] Display a image in Table cell in c#
本文介绍了在c#中的表格单元格中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个应用程序,其中数据可以以会话变量的形式从BlogEntry.aspx传递,例如
I want to make a application in which a data can be pass from BlogEntry.aspx in the form of session variable like
Session["Title"] = this.txtTitle.Text;
Session["Blog"] = this.txtBlog.Text;
Session["Name"] = this.txtName.Text;
Session["Changed"] = true;
Session["Image"] = this.Image1.ImageUrl;
// and redirect to another page-BlogList.aspx
// here,will maintain
//Database table from scratch
DataTable theTable = new DataTable("Comments");
ds.Tables.Add(theTable);
// add a name, time, title, and blog columns to our mock-up blog database
theTable.Columns.Add("Name", Type.GetType("System.String"));
theTable.Columns.Add("Time", Type.GetType("System.DateTime"));
theTable.Columns.Add("Title", Type.GetType("System.String"));
theTable.Columns.Add("Blog", Type.GetType("System.String"));
theTable.Columns.Add("Image", Type.GetType("System.String"));
//and then write on xml file-comment.xml like
// create a new DataRow
DataRow dr = ds.Tables["Comments"].NewRow();
// Populate the row from the text boxes filled by the user
dr[0] = Session["Name"];
dr[1] = System.DateTime.Now;
dr[2] = Session["Title"];
dr[3] = Session["Blog"];
dr[4] = Session["Image"];
//And display on table by
// add title (use a single column)//
TableRow tr = new TableRow();
tr.Cells.Add(new TableCell());
// change title color slightly
tr.Cells[0].ForeColor = Color.Navy;
tr.Cells[0].Width = 400;
// make the text title big and purple
tr.Cells[0].Text = "<font size="5" color="purple" face="Rockwell">" + dr[2].ToString() + "</font>";
this.BlogTable.Rows.Add(tr);
但不能显示一个图像由
tr.Cell [o] .text->
什么是合适的请帮助我plzzz帮助我
but Can''nt display a image by
tr.Cell[o].text->
what is suitable for that please help me plzzz help me
推荐答案
这似乎相当微不足道,至少来自 Google [ ^ ] search。
This seems to be rather trivial, at least from a Google[^] search.
这篇关于在c#中的表格单元格中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文