在提交按钮单击时在消息框中显示行值 [英] display row value in message box on submit button click

查看:60
本文介绍了在提交按钮单击时在消息框中显示行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家,



我的项目基于Asp.net c#,Sql2005数据库。



在我的网页上我有gridview with checkboxes,在这个gridview中我有一个名为Messages的列。



这个gridview下方我有提交按钮来保存这些数据。<当我选择一个复选框并单击提交按钮时,


。弹出框中必须显示弹出的消息,并选中复选框。



请帮助我。



谢谢。

Dear Experts,

My project is based on Asp.net c#,Sql2005 Database.

on my webpage i have gridview with checkboxes, In this gridview i have one column with name Messages.

below this gridview i have submit button to save this data.

when i select one checkbox and click on submit button. a popup message must be displayed with checkbox selected row in popup box.

Please can you help me.

thanks.

推荐答案

你可以尝试这样的事情



You can try something like this

protected void Submit_Click(object sender, EventArgs e)
{

    // Iterate through the Gridview Rows property
    foreach (GridViewRow row in Gridview1.Rows)
    {
        // Find the CheckBox
        CheckBox cb = (CheckBox)row.FindControl("CbID");
        if (cb != null && cb.Checked)
        {

            var selVal= GridView1.DataKeys[row.RowIndex].Value;
            // "Delete" the row
            lblSelected.Text += Convert.Tostring(selVal);
        }
    }

}





然后添加一个带模态弹出窗口的面板它由一个控件(这里只是我用过标签)组成,用于显示其中的选定值,并将模态弹出目标与提交按钮相关联。如果你想以这种方式使用它,可以添加一个简单的javascript。



希望这有帮助



Then Add a panel with a modal popup which consists of a control ( here just i have used label ) to display the selected values in it and associate the modal popup targetid with the Submit button . Add a simple javascript if you want to use it that way.

Hope this helps


这篇关于在提交按钮单击时在消息框中显示行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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