TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ranjithkumar_s
NA
1
0
Empty datagrid in ASP.NET
Apr 22 2004 2:41 AM
I dont understand. I am using this collection object to fill the data from database. I am using this colleciton object and constructing a datatable and later i am binding this datatable to the datagrid, but to my dismay, its not showing anything on screen. Well, when i debug i can see the data, but some how, the datagrid is not taking data from the datatable here is the sample code private void Page_Load(object sender, System.EventArgs e) { //Set Today's date and time information lblDate.Text=DateTime.Now.ToShortDateString().ToString() + " " + DateTime.Now.ToShortTimeString().ToString(); //DataGrid dgMainTopic=new DataGrid(); if(!IsPostBack) { //Populate the grid with the data for maintopics DataTable dgTable= PopulateMainTopicGrid(); dgMainTopic.DataSource=dgTable; dgMainTopic.DataBind(); } } private DataTable PopulateMainTopicGrid() { try { MBoard.MainTopicService.MainTopicsService MTService=new MBoard.MainTopicService.MainTopicsService(); MBoard.BoardCollection GridCollection=new MBoard.BoardCollection(); MBoard.MainTopicInfo.MainTopicInfo MTInfo=new MBoard.MainTopicInfo.MainTopicInfo(); GridCollection=MTService.getAllMainTopics(); DataTable dtMTopic=new DataTable(); DataRow drTopicRow; DataColumn drTopicCol; //Add all the column headers //Forum Topics Messages LastPost drTopicCol=new DataColumn(); drTopicCol.Caption="Forums"; drTopicCol.ColumnName="Forums"; dtMTopic.Columns.Add(drTopicCol); drTopicCol=new DataColumn(); drTopicCol.Caption="Topics"; drTopicCol.ColumnName="Topics"; dtMTopic.Columns.Add(drTopicCol); drTopicCol=new DataColumn(); drTopicCol.Caption="Messages"; drTopicCol.ColumnName="Messages"; dtMTopic.Columns.Add(drTopicCol); drTopicCol=new DataColumn(); drTopicCol.Caption="LastPost"; drTopicCol.ColumnName="LastPost"; dtMTopic.Columns.Add(drTopicCol); //Add all the rows(Data from the database) for(int i=0;i
Reply
Answers (
0
)
Uploading files using HtmlInputFile and FileStream
Asp.Net Webforms not visible in the browser