t01621
Member
- Joined
- Oct 3, 2008
- Messages
- 5
Hi Everyone
I have been working with c# for only around 2 weeks so sorry if I dont explain the problem very well
I am trying to pass a value from one aspx page to another (topallowedsites.aspx is the posting page and topallowedsitesdetails.aspx is the receiving page)
In topallowedsites.aspx I have a gridview which pulls data from my database to show external websites that have been used by internal network users.
I want to pass the value of the domain column to the topallowedsitesdetails.aspx page by clicking on a link in a HyperLinkField that is in the same row as the domain value column
Please see below gridview code;
[highlight=asp]
<asp:gridview
id="GridView1"
showfooter="false"
runat="server"
width="99%"
autogeneratecolumns="False"
cellpadding="1" cellspacing="1"
font-family="verdana" font-size="11px"
EmptyDataText="<br /><h5><center>No record found! <br />Please try searching again.</center></h5>">
<columns>
<asp:BoundField datafield="Domain" headertext="Domain" sortexpression="Domain" DataFormatString="<a href=http://{0}>{0}</a>"> <ItemStyle Wrap="false"/></asp:boundfield>
<asp:BoundField datafield="Url" headertext="No of Urls" sortexpression="url"/>
<asp:BoundField datafield="Username" headertext="No of Users" sortexpression="username"/>
<asp:BoundField datafield="categoryname" headertext="Category" sortexpression="categoryname"/>
<asp:BoundField datafield="Bytes in" headertext="Bytes In" sortexpression="Bytes In"/>
<asp:BoundField datafield="Bytes out" headertext="Bytes Out" sortexpression="Bytes Out"/>
<asp:HyperLinkField DataNavigateUrlFields="domain" DataNavigateUrlFormatString="topallowedsitesdetails.aspx?domain={0}" Text="Url Details" HeaderText="Url Details" />
</columns>
</asp:gridview>
[/highlight]
If I click on the link in the hyperlinkfield it opens up the topallowedsitesdetails.aspx page and adds the correct domain information in the address bar i.e. if I clicked on the hyperlinkfield link beside a domain column value of google.com it redirects me to http://localhost/test/topallowedsitesdetails.aspx?domain=google.com
so far so good, however the topallowedsitesdetails.aspx page doesnt return any results in its gridview? But If I use the asp:textbox search bar for a domain name such as google.com it does return results, so its like the value is being passed but not added into the domain search variable
Below is the code I have in the <script> tags on topallowedsitesdetails.aspx to retrieve the extra details for google.com from the database;
What am I missing? Hope someone can help
Many thanks
Tom
I have been working with c# for only around 2 weeks so sorry if I dont explain the problem very well
I am trying to pass a value from one aspx page to another (topallowedsites.aspx is the posting page and topallowedsitesdetails.aspx is the receiving page)
In topallowedsites.aspx I have a gridview which pulls data from my database to show external websites that have been used by internal network users.
I want to pass the value of the domain column to the topallowedsitesdetails.aspx page by clicking on a link in a HyperLinkField that is in the same row as the domain value column
Please see below gridview code;
[highlight=asp]
<asp:gridview
id="GridView1"
showfooter="false"
runat="server"
width="99%"
autogeneratecolumns="False"
cellpadding="1" cellspacing="1"
font-family="verdana" font-size="11px"
EmptyDataText="<br /><h5><center>No record found! <br />Please try searching again.</center></h5>">
<columns>
<asp:BoundField datafield="Domain" headertext="Domain" sortexpression="Domain" DataFormatString="<a href=http://{0}>{0}</a>"> <ItemStyle Wrap="false"/></asp:boundfield>
<asp:BoundField datafield="Url" headertext="No of Urls" sortexpression="url"/>
<asp:BoundField datafield="Username" headertext="No of Users" sortexpression="username"/>
<asp:BoundField datafield="categoryname" headertext="Category" sortexpression="categoryname"/>
<asp:BoundField datafield="Bytes in" headertext="Bytes In" sortexpression="Bytes In"/>
<asp:BoundField datafield="Bytes out" headertext="Bytes Out" sortexpression="Bytes Out"/>
<asp:HyperLinkField DataNavigateUrlFields="domain" DataNavigateUrlFormatString="topallowedsitesdetails.aspx?domain={0}" Text="Url Details" HeaderText="Url Details" />
</columns>
</asp:gridview>
[/highlight]
If I click on the link in the hyperlinkfield it opens up the topallowedsitesdetails.aspx page and adds the correct domain information in the address bar i.e. if I clicked on the hyperlinkfield link beside a domain column value of google.com it redirects me to http://localhost/test/topallowedsitesdetails.aspx?domain=google.com
so far so good, however the topallowedsitesdetails.aspx page doesnt return any results in its gridview? But If I use the asp:textbox search bar for a domain name such as google.com it does return results, so its like the value is being passed but not added into the domain search variable
Below is the code I have in the <script> tags on topallowedsitesdetails.aspx to retrieve the extra details for google.com from the database;
C#:
protected void Page_Load(object sender, EventArgs e)
{
string variable = Request.QueryString["domain"];
}
Many thanks
Tom
Last edited by a moderator: