在数据集中asp.net的foreach行做文字气球 [英] asp.net foreach row in dataset make a balloon with text

查看:120
本文介绍了在数据集中asp.net的foreach行做文字气球的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题要问你们。


  • 如何动态地添加项目到ASP.NET?

  • 有没有办法使文本?气球寻找盒

我知道如何让项目到DS的数据库,并填补它,阅读它的每一行有。但是这并不能帮助我很多,当我想动态地做一些东西,并得到一个文本气球认为就像如果你正在寻找您的手机和看到的文字messeges这就是我多么希望它看起来像。

我把我的code的例子,我告诉我如何填充数据集以及如何将数据绑定到一个GridView

DBControl.cs

 公共数据集的GetData(字符串的queryString)
    {
        DataSet的DS =新的DataSet();        尝试
        {
            //运行查询。
            SqlDataAdapter的适配器=新SqlDataAdapter的(的queryString,m_helpdeskconnection);            //填充DataSet。
            adapter.Fill(DS);        }
        抓住
        {            //连接失败。显示错误消息。            //Message.Text =无法连接到数据库。
        }
        返回DS;
    }

AdministrerBrugere.aspx.cs

  DBControl DB =新DBControl();
    字符串的queryString;    保护无效的Page_Load(对象发件人,EventArgs的发送)
    {
        如果(!Page.IsPostBack)
        {
            的queryString =SELECT KundeNr,Navn FROM昆德
            BindData();
        }
    }    私人无效BindData()
    {
        //运行查询并结合所产生的DataSet
        //到GridView控件。
        db.ConnOpenHelpdesk();
        DataSet的DS = db.GetData(的queryString);
        GridView1.DataSource = DS;
        GridView1.DataBind();        db.ConnCloseHelpdesk();
    }


解决方案

您可以使用的DataRepeater您的内容结合并使用具有CSS样式DIV一个ItemTemplate,使它看起来像一个气球。

尝试这些链接:
http://www.w3schools.com/css/css3_borders.asp
http://www.w3schools.com/aspnet/aspnet_repeater.asp

I got a question for you guys.

  • How do I Dynamicly add an item to asp.net?
  • there a way to make a balloon looking box of text?

I know how to get items into ds from database and fill it up and read it for each row there is. but that does not help me alot when I want to make dynamicly some stuff and get a ballon view of text just like if you are looking at your phone and see the text messeges thats how I want it to look like.

I took a example of my code where I show how I fill the dataset and how I bind the data into a Gridview

DBControl.cs

    public DataSet GetData(String queryString)
    {
        DataSet ds = new DataSet();

        try
        {
            //run the query.
            SqlDataAdapter adapter = new SqlDataAdapter(queryString, m_helpdeskconnection);

            // Fill the DataSet.
            adapter.Fill(ds);

        }
        catch
        {

            // The connection failed. Display an error message.

            //Message.Text = "Unable to connect to the database.";
        }
        return ds;
    }

AdministrerBrugere.aspx.cs

    DBControl db = new DBControl();
    String queryString;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            queryString = "SELECT KundeNr, Navn FROM Kunder";
            BindData();
        }
    }

    private void BindData()
    {
        // Run the query and bind the resulting DataSet
        // to the GridView control.
        db.ConnOpenHelpdesk();
        DataSet ds = db.GetData(queryString);
        GridView1.DataSource = ds;
        GridView1.DataBind();

        db.ConnCloseHelpdesk();
    }

解决方案

You could use a DataRepeater to bind your content and use an ItemTemplate that has a CSS styled DIV to make it look like a baloon.

Try these links: http://www.w3schools.com/css/css3_borders.asp http://www.w3schools.com/aspnet/aspnet_repeater.asp

这篇关于在数据集中asp.net的foreach行做文字气球的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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