如何在asp.net中的同一gridview单元中的不同位置设置按钮和文本框的位置 [英] how to set position of button and textbox in same gridview cell at different position in asp.net

查看:102
本文介绍了如何在asp.net中的同一gridview单元中的不同位置设置按钮和文本框的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi ..

我想在asp.net的同一gridview单元中的不同位置设置按钮和文本框的位置.我使用了gridview控件,其中在Gridview标题行中动态生成了按钮和文本框. valign = top和align = center以及按钮valign = bottom和align = right.provide soln.thanx

hi..

I want to set position of button and textbox in the same gridview cell at different position in asp.net.i have used gridview control in which, in the gridview header row dynamically buttons and textboxes are generated.i want to set postion of textbox to valign=top and align=center and for button valign=bottom and align=right.provide soln.thanx

推荐答案

而不是单独添加控件
在HtmlTable中添加两个控件.将HtmlTable添加到gridview中.

Rather than adding control individually
add both control in HtmlTable. Add that HtmlTable in gridview.

//Create linkbutton & textbox object & assign property here
HtmlTable table1 = new HtmlTable();
            HtmlTableRow row = new HtmlTableRow();
            HtmlTableCell cell;
            for (int j = 1; j <= 2; j++)
            {
                cell = new HtmlTableCell();
                
                if (j == 1)
                {
                    //linkbutton
                    cell.Controls.Add(lnkSortCol );
                    cell.VAlign = "Top";
                }
                else
                {
                    //textbox
                    cell.Controls.Add(txtFilter);
                    cell.VAlign = "Bottom";
                }
                row.Cells.Add(cell);
            }
            grvCtrl.HeaderRow.Cells(0).Controls.AddAt(0, table1);


这篇关于如何在asp.net中的同一gridview单元中的不同位置设置按钮和文本框的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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