I have a gridview which displays the records in the below form:
Date Total Enrolled Enrolled as Email Enrolled as Text
2/29/2012 12:00:00 AM 1 0 1
2/28/2012 12:00:00 AM 2 1 1
2/27/2012 12:00:00 AM 23 11 12
2/25/2012 12:00:00 AM 1 1 0
2/24/2012 12:00:00 AM 16 9 7
Which displays the record using this query:
select created,
count(field1) Enrolled,
count(case field1 when 'E-mail' then 1 end) Enrolled_as_Email,
count(case field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell,
(Select COUNT(*)
from tbl_TransactionDishout d
where d.created = c.created and
d.DishoutResponseCode = '0000') Deals_Redeemed
from tblCustomer c
group by created
order by created
ASP.NET Code is as below:
<asp:GridView ID="GrdReport" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="1" DataKeyNames="Created" DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="None" PageSize="100"
onrowdatabound="GrdReport_RowDataBound">
<Columns>
<asp:BoundField DataField="Created" HeaderText="Date" SortExpression="Created" />
<asp:BoundField DataField="Total_Enrolled" HeaderText="Total Enrolled" SortExpression="Total_Enrolled" />
<asp:BoundField DataField="Enrolled_as_Email" HeaderText="Enrolled as Email" SortExpression="Enrolled_as_Email" />
<asp:BoundField DataField="Enrolled_as_Cell" HeaderText="Enrolled as Text" SortExpression="Enrolled_as_Cell" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" Height="4" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Right" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ appSettings:DBConn %>"
SelectCommand="select created, count(field1) Total_Enrolled, count(case field1 when 'E-mail' then 1 end) Enrolled_as_Email, count(case field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell from tblCustomer group by created order by created desc">
</asp:SqlDataSource>
Now I want the number to be a hyperlink which redirect the page to some other page where it displays those records..
So how should it be done.?? What should I pass in query string such that I can recognize it on the redirected page..and how?
your linke would look like this…
http://address/page.aspx?parameter=value&nextparameter=value
http://localhost/newpage.aspx?email=0&text=1
in your asp.net page you can access query string like this
This is only one easy approach… If you build complex webapps you should take of more but this could get you started
if I have understand your question correct…
You should make sure that you encode the values to make them html safe…
EDIT: to construct your link use hyperlinkfield
to use multiple parameters comma seperate them like this
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkfield.aspx
then you need a 2nd page which dsiplays the details and queries the result based on the passed values…