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
Jim Van Dick
NA
16
0
Using ObjectDataSource to populate a DropDownField
Dec 20 2006 8:37 AM
I am attempting to use an ObjectDataSource to populate a DropDownList. I am passing parameters to the following method in order to determine what should be in the drop down. I have determined that when a dataset is being referenced, the following error comes up:
Error: There was an error rendering the control. Exception has been thrown by the target of an invocation.
Code:
public static DataView TstGetPhaseListForProjects(int projectId, int tableOrigin)
{
DataTable dt = new DataTable("PhaseList");
dt.Columns.Add("code");
dt.Columns.Add("name");
string phaseNumber;
DataSet dsData = new DataSet();
//SqlHelper.ExecuteDataset(System.Configuration.ConfigurationManager.AppSettings[ODSComponentsLibrary.GlobalVars.CfgKeyConnStringODSNOP], SP_SELECT,
// tableOrigin, 0, projectId, "All");
foreach (DataRow row in dsData.Tables[0].Rows)
{
phaseNumber = row["phase_no"].ToString();
dt.Rows.Add(phaseNumber, phaseNumber);
}
return (dt.DefaultView);
}
The above error shows up on the GridView rendering and the Gridview does not draw properly.
Thanks in advance for your help.
Reply
Answers (
0
)
inserting names into DropDownList.
Calling Property and method of a user control from another user control