我想从网格视图填充文本框 [英] I would like to fill the text box from a grid view

查看:63
本文介绍了我想从网格视图填充文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我有一个gridview,它有数据。我尝试过的单元格不可编辑但无法使它们可编辑。



然后我希望当我点击单元格时,应该在文本框中填充值。





问候,

Vengaqua

Dear all,

I have a gridview and it is having data. The cells are not editable i tried but could not make them editable.

Then i want that when i click on the cell the value should be filled in the textbox.


Regards,
Vengaqua

推荐答案

你可以看看这个



如何从网格视图中获取所选行的值 - 使用Asp-Net / [ ^ ]
You can have a look at this

how-to-get-the-values-of-selected-row-from-a-gridview-using-Asp-Net/[^]


嗨...

看到此链接,编辑gridview时出现文本框。

http://www.aspdotnet-suresh。 com / 2011/02 / how-to-inserteditupdate-and-delete-data.html [ ^ ]

谢谢你。
Hi...
See this link, textbox appeare when edit the gridview.
http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html[^]
thank u.








这是一个可以使用的示例代码

你可以使用




this is an sample code you can use
you can use
OnRowCommand="Countrylist_RowCommand"







in c#




in c#

protected void Countrylist_RowCommand(object sender, GridViewCommandEventArgs e)//TO FETCH PARTICULAR RECORD SELECTED FROM GRID FOR EDIT
       {
           if (e.CommandName == "EditRow")
           {
               string strCode = (string)e.CommandArgument;
               txt_countryid.Text = strCode;
              con.Open;
               DataSet ds = new DataSet();
               OleDbDataReader reader = null;
               OleDbCommand cmd = new OleDbCommand();
               cmd = new OleDbCommand("select * from Country_master where CountryId=" + strCode + "", con);
               reader = cmd.ExecuteReader();
               while (reader.Read())
               {
                   txt_countrycode.Text = reader["CountryCode"].ToString();
                   txt_countryname.Text = reader["CountryName"].ToString();

               }
               con.Close();
           }
       }









希望这有助于你

快乐编码:)





Hope this Helps you
happy coding :)


这篇关于我想从网格视图填充文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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