Tuesday, 21 August 2012

Query String in ASP.Net


pass the value through url from previous page
 int FromID = Convert.ToInt32(Session["User_Id"]);
 string url = "EmployeeDetails.aspx?From_ID=" + FromID.ToString();
 Response.Redirect(url);

Accept the value which passed by url 

 string From_ID = Request.QueryString["From_ID"].ToString();


Friday, 17 August 2012

view Delivery formate usage

Create view [dbo].[Vw_Delivery_format_usage]
as

Select distinct grant_id,delivery_format_name,approved_amount,date_submitted From (

Select t1.grant_id,
case when t1.TotalValue=1 then tad.delivery_format_name
else 'MultiView'
end as delivery_format_name
,approved_amount
,g.date_submitted,TotalValue
From (
Select COUNT(delivery_format_name) as TotalValue,grant_id from (
        select
        distinct a.grant_id,
        tad.delivery_format_name,
        g.approved_amount
        from t_grant_request g
        inner join t_grant_activity a on a.grant_id=g.grant_id
        inner join t_activity_delivery_format tad on tad.delivery_format_id=a.delivery_format_id
)t
group by grant_id
)t1 inner join
t_grant_request g on t1.grant_id=g.grant_id
inner join t_grant_activity a on a.grant_id=g.grant_id
and g.approved_amount is not null
and approved_amount not in (0) 
and g.grant_status not in ('not submitted','cancelled','denied','rejected')
inner join t_activity_delivery_format tad on tad.delivery_format_id=a.delivery_format_id
)t2