Unable to populate data in the radgrid

Posted by Arun11 under ASP.NET on 7/4/2011 | Points: 10 | Views : 3241 | Status : [Member] | Replies : 4
Hi,

I am totally breaking my head on this.It might seem quite simple to u guys.So please help me. i am very very new to asp .net.

I have implemented DataSet functionality in the DAL,BAL and UI layers.

The OUTPUT should be such that when page loads data in the dataset should be populated on the grid based on the userID.

Below is my entire code:

DAL:

public class SHTemplateDA:Base.SQLDatabase
{
public DataSet GetSHTemplateListByUserDA(string strUserID)
{
SqlCommand objSqlCommand = Execute.GetCommandObject();
objSqlCommand.CommandText = "SHR_Select_TemplateListByUser";
objSqlCommand.Parameters.AddWithValue("@USER_ID",strUserID);
objSqlCommand.CommandType = CommandType.StoredProcedure;
return Execute.ExecuteDataset(objSqlCommand);


}
}
BAL:
public class SHTemplateBA : DataAccess.SHTemplateDA
{
public DataSet GetSHTemplateListByUserBA(string strUserID)
{
return GetSHTemplateListByUserDA(strUserID);
}

}
UI:
public class SHTemplateUI
{
public DataSet GetSHTemplateListByUserUI(string strUserID)
{
return new SHTemplateBA().GetSHTemplateListByUserBA(strUserID);
}

}
aspx.cs(linking UI layer with the code file):



protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.LoadTemplateList();
}
}
public void LoadTemplateList()
{

Session["USERID"] = "XYZ";
SHTemplateUI myobj = new SHTemplateUI();
this.rgTemplateList.DataSource = myobj.GetSHTemplateListByUserUI(Convert.ToString(Session["USERID"]));
this.rgTemplateList.DataBind();
}
I am not able to populate data in the grid. Please advise me the changes that i have to do in this. Any help would be appreciated.

Thanks,
Arun




Responses

Posted by: Vuyiswamb on: 7/6/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
in your stored Procedure , when you pass a USERID does it return Data ?


Thank you for posting at Dotnetfunda
[Administrator]

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arun11 on: 7/6/2011 [Member] Starter | Points: 25

Up
0
Down
Hello sir,

I am sorry.i did not understand your question. Below is my SP:

Create PROCEDURE [apqcstars].[SHR_Select_TemplateListByUser]
@USER_ID VARCHAR(40)
AS
BEGIN
SELECT
StudentHistoryTemplateID, TemplateName, CreatedBy, CreatedDate, ShowComment, IsPrivate, ClassSchedule, CustomGroupID, RosterID, PrintGroup, IsTemporary
FROM
StudentHistoryTemplate
WHERE
CreatedBy = @USER_ID

END

i want to display values of only three columns TemplateName, CreatedBy, CreatedDate in the grid and remaining columns should not be displayed.





Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/6/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
show me the definition of the grid xml or html

Thank you for posting at Dotnetfunda
[Administrator]

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arun11 on: 7/6/2011 [Member] Starter | Points: 25

Up
0
Down
Its telerik radgrid:

<telerik:RadGrid ID="rgTemplateList" runat="server" AutoGenerateColumns="false" Skin="">
<MasterTableView AutoGenerateColumns="false" TableLayout="Fixed" CssClass="table_12">
<ItemStyle CssClass="even" />
<AlternatingItemStyle CssClass="odd" />
<PagerStyle Mode="NextPrev" />
<Columns>
<telerik:GridTemplateColumn HeaderText="Sl. No." HeaderStyle-Width="50px" HeaderStyle-CssClass="bl_0">
<ItemTemplate>
<asp:Label ID="lblSerialNumber" runat="server"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Template Name" HeaderStyle-CssClass="la"
ItemStyle-CssClass="la">
<ItemTemplate>
<asp:Label ID="lblTemplateName" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Created By" HeaderStyle-CssClass="la" ItemStyle-CssClass="la">
<ItemTemplate>
<asp:Label ID="lblCreatedBy" runat="server"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Date Of Creation" HeaderStyle-CssClass="la"
ItemStyle-CssClass="la">
<ItemTemplate>
<asp:Label ID="lblDateOfCreation" runat="server"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Copy" HeaderStyle-Width="60px" HeaderStyle-CssClass="ca"
ItemStyle-CssClass="ca">
<ItemTemplate>
<asp:LinkButton ID="lbtnCopytemplate" runat="server" CommandName="Copy">
<img src="../App_Themes/Default/img/icon_table_copy.png" alt="copy" align="middle" /></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Edit" HeaderStyle-Width="60px" HeaderStyle-CssClass="ca"
ItemStyle-CssClass="ca">
<ItemTemplate>
<asp:LinkButton ID="lbtnEditTemplate" CommandName="Edit" runat="server">
<img src="../App_Themes/Default/img/icon_table_edit.png" alt="edit" align="middle" /></asp:LinkButton></ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Delete" HeaderStyle-Width="60px" HeaderStyle-CssClass="ca"
ItemStyle-CssClass="ca">
<ItemTemplate>
<asp:LinkButton ID="lbtnDeleteTemplate" CommandName="Delete" runat="server">
<img src="../App_Themes/Default/img/icon_test_delete.png" alt="delete" align="middle" /></asp:LinkButton></ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Schedule" HeaderStyle-Width="60px" HeaderStyle-CssClass="ca"
ItemStyle-CssClass="ca">
<ItemTemplate>
<asp:LinkButton ID="lbtnScheduleTemplate" CommandName="Schedule" runat="server">
<img src="../App_Themes/Default/img/icon_schedule.png" alt="schedule" align="middle" /></asp:LinkButton></ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>



Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response