如何通过单击gridview中的链接按钮将值从db获取到弹出窗口? [英] how to get values from db to popup window by clicking linkbutton in gridview..?

查看:65
本文介绍了如何通过单击gridview中的链接按钮将值从db获取到弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 in gridview i have link button "lbnOrderId" 
when im clicking "lbnOrderId" i want to display(@orderId,@UserName,@PhoneNo)
 in popup window.

推荐答案

在GridView1_RowCommand

一样使用
On GridView1_RowCommand
use like as
protected void fect_taskid(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            
                int index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row = GridView1.Rows[index];
                lblassinmentno.Text = row.Cells[1].Text;
                lblassinedon.Text = row.Cells[9].Text;
                lblcontactno.Text = row.Cells[8].Text;
                lbldeptt.Text = row.Cells[4].Text;
                lblempcode.Text = row.Cells[3].Text;
                lblmailid.Text = row.Cells[6].Text;
                lblName.Text = row.Cells[2].Text;
                designation.Text = row.Cells[5].Text;
                GridView3.DataBind();
                this.modal11.Show();
            
        }
        catch(Exception ex)
        {
            
        }



只要使用绑定表达式,只要根据您的查询更改语句即可即可.
Hi ,
Just change statement according to your Query as long you are using Bind expression just Give to Grid Data soure .
void Getdata()
 {
     SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=test;Integrated Security=True");
     string statement = "select item_code, Item_name, brand, size, section, price, Material, Qty, tax, tt  from Items ";
     SqlDataAdapter da = new SqlDataAdapter(statement, con);
     DataSet ds = new DataSet();
     da.Fill(ds);
     GridView1.DataSource = ds;
     GridView1.DataBind();
 }


最好的问候
米特瓦里(M.Mitwalli)


Best Regards
M.Mitwalli


这篇关于如何通过单击gridview中的链接按钮将值从db获取到弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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