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
Di Silva
NA
3
460
Cascading Drop Listings
Sep 4 2019 6:13 AM
I am very new to the field of programming. I am still training on .NET technologies but not sure if I have got the concept. But now I am required to complete a project.
I am working on a online school fee paymment projects with 3 tier architecture.
The three modules are Admin, School Accountant and Parent.
The Admin would add the accountants for each school and the account for the specific school would need to add the class and students of his school.
I was able to proceed a little bit from an old project(Copy & paste). However I am not able to proceed with creating a two drop down lists.
I am needing to create a webpage where it will show to the account to select the class and after selecting the class, adding the each student details.
My Source page is :
<%@ Page Title="" Language="C#" MasterPageFile="~/Accountant/Accountant.Master" AutoEventWireup="true" CodeBehind="AddStudent.aspx.cs" Inherits="OnlineFeePayment.Accountant.AddStudent" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h1>Add Students</h1>
<asp:Label ID="Label1" runat="server" Text="Select Class"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
<asp:Label ID="Label2" runat="server" Text="Student Name"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
<asp:Label ID="Label3" runat="server" Text="Upload Student Image"></asp:Label>
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
</asp:Content>
--------------------------------------
I was able to create one dropdown list using the following code:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
DataSet D = StateHelper.SelectSchool();
DropDownList1.DataSource = D;
DropDownList1.DataTextField = "School_Complete";
DropDownList1.DataValueField = "School_Id";
DropDownList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
Class C=new Class();
C.Class_Name = TextBox1.Text;
C.School_Id = int.Parse(DropDownList1.SelectedItem.Value);
ClassHelper.AddClass(C);
}
---------------------------------------------------------
namespace BO
{
public class Student
{
public int Student_Id { get; set; }
public string Student_Name { get; set; }
public string Student_Image { get; set; }
public int Class_Id { get; set; }
}
}
----------------------------------------------------------
namespace DAL
{
public class StateHelper
{
public static void AddState(State S)
{
DataManager.InsertUpdateDelete("ADDSTATE", S.State_Name);
}
public static DataSet SelectState()
{
DataSet S1 = DataManager.GetDataSet("SELECTSTATE");
return S1;
}
public static DataSet SelectDistrict()
{
DataSet S = DataManager.GetDataSet("SELECTDISTRICT");
return S;
}
public static DataSet SelectSchool()
{
DataSet S2 = DataManager.GetDataSet("SELECTSCHOOL");
return S2;
}
}
}
----------------------------------------
I was able to find few posts about cascading droplist however I was not able to understand how I could use it in my project.
Can someone please help me with the code to complete the 2 droplist with a little bit of explanation.?
Thanks in Advance.
Reply
Answers (
2
)
How to Secure or Delete ".AspNet.ApplicationCookie"
Need help to populate value into SearchLookUpEdit control