Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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.
Posted

1 solution

Hi,

Try this if could help...

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


ASP.NET
<%@ 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>


Code in Code behind (Channel.aspx):

C#
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();
   }
  
}


In Custom control (Channel.ascx) code behind:

C#
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,
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900