如何将值从gridview传递到弹出窗口 [英] how to pass value from gridview to popup window

查看:122
本文介绍了如何将值从gridview传递到弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个程序,我将TASK的数据表绑定到gridview.user可以轻松地逐日更新任务的进度(来自TASK表的列状态).但是随后出现一种情况,用户希望在任务关闭时将其关闭正式完成.

所以我想出了主意,请在gridview中添加一列,以便用户选择要关闭的任务,然后弹出一个窗口.从这里,他们输入关闭任务然后保存的原因.
它实际上是一个技巧.我获得了他们进入状态列并更新到状态列的原因的价值.并且该行(已关闭任务)将不再在该gridview中.出现这个技巧是因为我不知道如何关闭不再需要发展的任务.

现在的问题是我不知道如何将选定的行值从gridview传递到弹出窗口,并且可以对其进行编辑.

预先感谢,
musiw.

hi guys,

i have a program where i bind data table of TASK to a gridview.user can easily update the progress of the task day by day(column status from TASK table).but then come a situation where user want to close the task when it is officially completed.

so i come out with idea, add a column in gridview in order to user select the task they want to close and then popup a window.from here they enter the reason to close task and then save.

its actually a trick.i get value of the reason that they enter and update into the status column.and the row (which task is closed)will be no longer in that gridview.this trick is come out because i dont know how to close a task that no longer need to develop.

the problem now is i dont know how to pass the selected row value from gridview into popup window and can be edited.

thanks in advance,
musiw.

推荐答案



如果可以的话请尝试...

在这里我使用的是AjaxControToolkit.dll版本3.020229.0
在客户端代码中:


Hi,

Try this if could help...

Here I use AjaxControToolkit.dll version-3.020229.0
In Client code:


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/Channel.ascx" TagName="ucAddChannel" TagPrefix="uc3" %>
//Some Code...
..
..
 <asp:BoundField DataField="Channel_Status" SortExpression="Channel_Status" ItemStyle-HorizontalAlign="Left"

 HeaderText="Channel Status" HeaderStyle-HorizontalAlign="Left" />
 <asp:ButtonField CommandName="cmdView" Text="View/Edit" />
..
<cc1:ModalPopupExtender  runat="server" ID="mpeAddChannel" TargetControlID="hfAddChannel"

   PopupControlID="panelAddChannel" BackgroundCssClass="modalBackground" DropShadow="true">
</cc1:ModalPopupExtender>
<asp:Button SkinID="skinButtonM" runat="server" ID="hfAddChannel" Style="display: none" />
<asp:Panel runat="server" Width="70%" ID="panelAddChannel" Style="display: none;">
  <uc3:ucAddChannel  runat="server" ID="ucAddChannel" />
</asp:Panel>



背后的代码(Channel.aspx)中的代码:



Code in Code behind (Channel.aspx):

protected void grdChannel_RowCommand(object sender, GridViewCommandEventArgs e)
{ 
   if (e.CommandName == "cmdView")
   {
     index = Convert.ToInt32(e.CommandArgument);
     GridViewRow row = this.grdChannel.Rows[index];
     strChannelCode = this.grdChannel.Rows[index].Cells[1].Text.Trim();
     strChannelNo = this.grdChannel.Rows[index].Cells[2].Text.Trim();
     ucAddChannel.PassValue("(Edit)", channelNo);
     mpeAddChannel.Show();
   }
  
}



在自定义控件(Channel.ascx)后面的代码:



In Custom control (Channel.ascx) code behind:

public void PassValue(string task, string channelNo)
{
   Session["Task"] = task;
   this.lblTask.Text = task;
   if (task == "(Edit)")
   {
      this.hfChannelCode.Value = channelCode;
      this.hfChannelIdNo.Value = channelNo;
      List<channel_mstr> lst = new List<channel_mstr>();
      lst = cmd.GetChannel( Convert.ToInt32(channelNo))
      this.txtChannelName.Text = Tools.IifStr(lst[0].Channel_Name);
   }
   else
   {
      if (task == "(Add)")
      {
         InitializeEntry();    
      }
   }
   upChannel.Update();
}
</channel_mstr></channel_mstr>



如果可以的话请投票...

问候



Please vote if could help...

Regards,


这篇关于如何将值从gridview传递到弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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