how should i do it?

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: how should i do it?

 
0
  #11
Apr 22nd, 2009
Hi,

In the code shown below if you want to pass values to next page containing primary key of the record then change the code to
  1. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "ServerID")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "ServerID")+ ">Delete</a>" %>'></asp:Label>
If u r query is achieved,mark the thread as solved

Live and Let Live
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: how should i do it?

 
0
  #12
Apr 22nd, 2009
hi,

I still get errors do I need something in the server side code?:

  1. Compiler Error Message: CS0103: The name 'ch' does not exist in the current context
  2.  
  3. Source Error:
  4.  
  5.  
  6.  
  7. Line 39: <asp:TemplateField HeaderText="Action">
  8. Line 40: <ItemTemplate>
  9. Line 41: <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Delete</a>" %>'></asp:Label>
  10. Line 42: </ItemTemplate>
  11. Line 43: <ItemStyle HorizontalAlign="Center" />

Code is as follows:

  1. <asp:GridView ID="ListOfServers" runat="server" AllowPaging="True"
  2. AllowSorting="True" AutoGenerateColumns="False" BorderStyle="Solid"
  3. BorderWidth="2px" CaptionAlign="Bottom" CellPadding="4" DataKeyNames="ServerID"
  4. DataSourceID="SqlDataSource1" Font-Bold="True" Font-Names="Cordia New"
  5. Font-Size="Medium" ForeColor="#333333" HorizontalAlign="Center"
  6. ToolTip="This table contains the current list of monitored servers."
  7. Width="95%">
  8. <RowStyle BackColor="#EFF3FB" />
  9. <Columns>
  10. <asp:CommandField ShowSelectButton="True" />
  11. <asp:BoundField DataField="ServerID" HeaderText="ServerID"
  12. InsertVisible="False" ReadOnly="True" SortExpression="ServerID" />
  13. <asp:BoundField DataField="HostName" HeaderText="HostName"
  14. SortExpression="HostName" />
  15. <asp:BoundField DataField="MachineType" HeaderText="MachineType"
  16. SortExpression="MachineType" />
  17. <asp:BoundField DataField="Kernel" HeaderText="Kernel"
  18. SortExpression="Kernel" />
  19. <asp:BoundField DataField="SerialNo" HeaderText="SerialNo"
  20. SortExpression="SerialNo" />
  21. <asp:BoundField DataField="PrimaryIP" HeaderText="PrimaryIP"
  22. SortExpression="PrimaryIP" />
  23. <asp:TemplateField HeaderText="Action">
  24. <ItemTemplate>
  25. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=frmAgents.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Delete</a>" %>'></asp:Label>
  26. </ItemTemplate>
  27. <ItemStyle HorizontalAlign="Center" />
  28. <HeaderStyle HorizontalAlign="Center" />
  29. </asp:TemplateField>
  30. </Columns>
  31. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  32. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  33. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  34. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  35. <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"
  36. VerticalAlign="Middle" Wrap="True" />
  37. <AlternatingRowStyle BackColor="White" />
  38. </asp:GridView>
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 217
Reputation: mail2saion is an unknown quantity at this point 
Solved Threads: 31
mail2saion's Avatar
mail2saion mail2saion is offline Offline
Posting Whiz in Training

Re: how should i do it?

 
0
  #13
Apr 22nd, 2009
Change DataBinder.Eval(Container.DataItem, "Id") by DataBinder.Eval(Container.DataItem, "ServerID")
And change frmagents.aspx to your page.

Always post the error details otherwise it will be difficult for others to identify the problem.
MARK AS SOLVED if its help you.

REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 399
Reputation: chris5126 is an unknown quantity at this point 
Solved Threads: 14
chris5126 chris5126 is offline Offline
Posting Whiz

Re: how should i do it?

 
0
  #14
Apr 22nd, 2009
Hi,

I still get the error ch does not exist in the current context does it need to be decalred in the aspx.cs page?:

code now reads:

  1. <asp:Label ID="lblEdit" runat="server" Text='<%# "<a href=frmAgents.aspx?Cmd=EDIT&NavigateId=" + DataBinder.Eval(Container.DataItem, "Id")+ ">Edit</a>"+" | "+ "<a onclick="+ch+"return ConfirmChoice()"+ ch +" href=monitor.aspx?Cmd=DELETE&NavigateId=" + DataBinder.Eval(Container.DataItem, "ServerId")+ ">Delete</a>" %>'></asp:Label>
If my post helped add to my rep!
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 217
Reputation: mail2saion is an unknown quantity at this point 
Solved Threads: 31
mail2saion's Avatar
mail2saion mail2saion is offline Offline
Posting Whiz in Training

Re: how should i do it?

 
0
  #15
Apr 22nd, 2009
YES PUT THE LINE public char ch = '"'; just above your page load method like protected void Page_Load(object sender, EventArgs e)
MARK AS SOLVED if its help you.

REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC