0
我正在開發一種允許某些員工查看客戶調查結果的類別經理。我正在跟蹤接受調查的客戶的IP地址,並向可查看結果的員工顯示該IP地址。我正在使用一個帶有sqldatasource的gridview將數據從數據庫中提取出來並顯示出來。 我想要做的是添加一個按鈕或鏈接,獲取IP地址並將其附加到網站的URL以跟蹤地圖上IP地址的位置。我已經註冊了一個服務來做到這一點,但我不確定如何編寫它。gridview中將用戶重定向到url的按鈕
這裏是我的GridView
<asp:GridView ID="GVnewsletterManager" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True"
BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
CellPadding="4" DataKeyNames="email_time" ForeColor="Black"
GridLines="Horizontal" Width="100%" PageSize="15">
<Columns>
<asp:BoundField DataField="email_time" HeaderText="Length of Email Subscription"
SortExpression="email_time" />
<asp:BoundField DataField="reason" HeaderText="Reason for Unsubscribe"
SortExpression="reason" />
<asp:BoundField DataField="other" HeaderText="Other Reason"
SortExpression="other" />
<asp:BoundField DataField="other_comments" HeaderText="Other Comments" SortExpression="other_comments"
ReadOnly="True" />
<asp:BoundField DataField="DateTime" HeaderText="Date"
SortExpression="DateTime" />
<asp:BoundField DataField="IP" HeaderText="Client IP" SortExpression="IP" />
<asp:ButtonField ButtonType="Button" Text="Trace IP to Map" />
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White"
HorizontalAlign="Left" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
預先感謝您的幫助!
檢查:http://weblogs.asp.net/gurusarkar/archive/2010/09/23/pass-querystring-parameter-with- navigaterurl-in-hyperlink-inside-a-gridview.aspx – gbs 2011-01-11 16:38:59
將它作爲答案,我會給你信用。 – tking 2011-01-11 17:06:21