在gridview中具有选定索引上的linkbutton获取值 [英] in gridview have linkbutton on selected index get value

查看:92
本文介绍了在gridview中具有选定索引上的linkbutton获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在每行中都有5个链接按钮的gridview.
我需要通过griview_selectedindex()函数选择行时,我应该能够获取分配给链接按钮的文本
感谢

I have a gridview in witch 5 linkbuttons in each row.
i need when i select row by griview_selectedindex() function i should be able to get the text assigned to link button
thanks

推荐答案


试试这个
Hi ,
try this
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        string linkname = ((LinkButton) GridView1.Rows[e.NewSelectedIndex].FindControl("LinkButton1")).Text;

    }


最好的问候
M.Mitwalli


Best Regards
M.Mitwalli


嘿,

您可以像这样获得gridview控件

Hey,

u can get gridview control Like this

Label myLabel = (Label)myGridView.Rows[myGridView.SelectedIndex].Cells[2].FindControl("myLabel");



希望这对您有帮助



hope this will help u


这篇关于在gridview中具有选定索引上的linkbutton获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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