I want to fetch data from the database for that I use SP i.e.
if(@type=7)
BEGIN
SELECT
P.Id as ProjectID
,A.[Id] as ActivityID
--,A.[Name] As ActivityName
,CONCAT(A.[Name],(Select top(1) CONCAT(' ( ',Y.Name,' )') from [dbo].[ProjectActivityMasters] x join Sectors y on x.AltSectorId=y.Id where x.Id=A.Id)) As ActivityName
,CASE WHEN
A.[Role] is NULL THEN 'Applicant Level'
WHEN A.[Role]='fo' then 'Departmental Level' end as ActivityLevel
,(Select Sum(ApplicationsApproved) from [dbo].[Dashboard_ApplicationsStatistics] where ActivityID=A.Id) as ApplicationsApproved
,(Select Sum(ApplicationsRejected) from [dbo].[Dashboard_ApplicationsStatistics] where ActivityID=A.Id) as ApplicationsRejected
,(Select Sum(ApplicationsUnderProcess)+SUM(ApplicationsPending) from [dbo].[Dashboard_ApplicationsStatistics] where ActivityID=A.Id) as ApplicationsUnderProcess
FROM [dbo].[ProjectActivityMasters] A
RIGHT JOIN [dbo].[Projects] P
on A.ProjectId=P.Id
where P.id=@ProjectID and A.IsActive=1
ORDER BY a.Role
END
for display records I implement this way
<%# Eval("ActivityName") + "-[" + Eval("ActivityLevel") + "]" %>
Applications Approved
<%# Eval("ApplicationsApproved") %>
Applications Rejected
<%# Eval("ApplicationsRejected") %>
Applications Under Process
<%# Eval("ApplicationsUnderProcess") %>
in the code, I used the method on page load but didn't get any record
private void BindRepeaterActivitywiseDisplay()
{
if (Session["ProjectID"] != null)
{
SqlParameter[] sqlParameters = {
new SqlParameter("@type", "7"),
new SqlParameter("@ProjectID", Session["ProjectID"].ToString()),
};
var ds = DbAccessLogic.GetData("DashboardData", sqlParameters);
if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
RepeaterActivitywiseDisplay.DataSource = ds;
RepeaterActivitywiseDisplay.DataBind();
}
}
}
I don't get where I am wrong, please suggest to me
Tuhin PaulPosted Mar 28, 2024, 3:14 AM
The session variable
Session["ProjectID"]is correctly set and has a value before calling theBindRepeaterActivitywiseDisplay()method. You can add debugging statements or breakpoints to ensure that the session variable contains the expected value.