<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Student_FeedbackForm.aspx.cs" MasterPageFile ="~/Master_Student_Form.master" Inherits="Student_FeedbackForm" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1";ID="cnt1" runat="server">
<table align="center" style="width: 31%">
<tr>
<td>
<asp:Label ID="lblMsg" Text ="" runat ="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="StudentFeedbackForm" Text = "Student Feedback Form" runat ="server" Font-Bold="True" ForeColor="Blue"></asp:Label>
</td>
</tr>
</table>
<table align="center" style="width:80%">
<tr>
<td class="style1">
<asp:Label ID= "lblCourse" runat= "Server" Font-Bold="True" ForeColor="Blue" Width="75px" Font-Names="Verdana">Course</asp:Label>
<asp:DropDownList ID="ddlcourse" runat="server" AutoPostBack="true" Width="190px"
OnSelectedIndexChanged="ddlcourse_SelectedIndexChanged" Font-Names="Verdana"></asp:DropDownList>
</td>
<td >
<asp:Label ID= "lblBatch" runat= "Server" Font-Bold="True" ForeColor="Blue"
Font-Names="Verdana">Batch</asp:Label>
<asp:DropDownList ID="ddlbatch" runat = "server"
AutoPostBack ="true" Width ="243px" Font-Names="Verdana" Height="20px"
onselectedindexchanged="ddlbatch_SelectedIndexChanged"></asp:DropDownList>
</td>
</tr>
<asp:Panel id="pnlfac" runat="server" backcolor="Beige" ScrollBars="Auto" bordercolor ="Black"
borderstyle="Solid" borderwidth="1px" height="226px" Width="1095px"
HorizontalAlign="Center">
<asp:GridView id="gvfaculty" runat="server" backcolor="LightGoldenrodYellow"
BorderColor="Tan" width="1090px" ForeColor="Black" AutoGenerateColumns ="False"
EnableModelValidation="True"
OnRowCreated ="gvfaculty_RowCreated">
<FooterStyle BackColor="Tan"/><AlternatingRowStyle BackColor="PaleGoldenrod" />
<Columns>
<asp:BoundField DataField="Facname" HeaderText="Faculty" >
<ItemStyle Font-Names="Verdana" Font-Size="Small" HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Facid" HeaderText="Facultyid" />
<asp:TemplateField HeaderText="Does the Faculty come well prepared for his subject">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="true">
</asp:DropDownList>
</ItemTemplate>
<ItemStyle Font-Names="Verdana" Font-Size="Small" HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Is he loud and clear in his speech">
<ItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" AppendDataBoundItems="true"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<HeaderStyle BackColor="Tan" Font-Bold="True" HorizontalAlign="Left" Font-Names="Verdana" Font-Size="Small" /><pagerstyle backcolor="PaleGoldenrod" forecolor="DarkSlateBlue" horizontalalign="Center"><SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
ddlbatch selected index change code as follows
protected void ddlbatch_SelectedIndexChanged(object sender, EventArgs e)
{
lblMsg.Text = "";
try
{
lblMsg.Text = "";
try
{
sql = "SELECT sel.fac_id as Facid, fac.facname as facname,fac.type FROM Tb_Presea_Feedback_Launch l,Tb_Presea_Faculty_Selected sel,";
sql = sql + "Tb_Presea_Faculty_Master fac where l.launch_id = sel.launch_id and l.batch_id = '" + ddlbatch.SelectedValue.ToString().Trim() + "'";
sql = sql + "and l.active = 'A' and fac.facid = sel.fac_id and fac.type = 'F'";
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("facname", typeof(string)));
dt.Columns.Add(new DataColumn("Facid", typeof(string)));
dr = scon.ReadSql(sql);
gvfaculty.DataSource = dr;
gvfaculty.DataBind();
if (gvfaculty.Rows.Count <= 0)
{
lblMsg.Text = "Feedback is not launched for this batch";
ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('Feedback is not launched for this batch')", true);
return;
}
}
catch (Exception e1)
{
lblMsg.Text = e1.Message.ToString();
return;
}
setintialrow();
}
catch (Exception ex)
{
lblMsg.Text = "Unable to Load Data" + ex.Message.ToString();
return;
}
}
In the run mode screen as follows
Studentfeedback form
Course ddlcourse Batch ddlbatch
When i select the ddl course in batch all batch details will be displayed and when i select the ddlbatch the gridview will be displayed.
But when i use the update panel in source as follows
<asp:UpdatePanel ID = "UpdatePanel1" ChildrenAsTriggers="true" runat ="server">
<ContentTemplate>
<asp:UpdatePanel ID = "UpdatePanel1" ChildrenAsTriggers="true" runat ="server">
<contenttemplate>
<asp:Label ID="lblMsg" Text ="" runat ="server" Font-Bold="True" ForeColor="Red">
|
<asp:Label ID="StudentFeedbackForm" Text = "Student Feedback Form" runat ="server" Font-Bold="True" ForeColor="Blue">
|
<asp:Label ID= "lblCourse" runat= "Server" Font-Bold="True" ForeColor="Blue" Width="75px" Font-Names="Verdana">Course
<asp:DropDownList ID="ddlcourse" runat="server" AutoPostBack="true" Width="190px"
OnSelectedIndexChanged="ddlcourse_SelectedIndexChanged" Font-Names="Verdana">
| <asp:Label ID= "lblBatch" runat= "Server" Font-Bold="True" ForeColor="Blue"
Font-Names="Verdana">Batch
<asp:DropDownList ID="ddlbatch" runat = "server"
AutoPostBack ="true" Width ="243px" Font-Names="Verdana" Height="20px"
onselectedindexchanged="ddlbatch_SelectedIndexChanged">
<asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server"
ErrorMessage="Please Select Batch" ControlToValidate="ddlbatch"
Font-Names="Verdana" Font-Size="Medium"
InitialValue="--Please Select the Batch Date--">
|
<asp:UpdateProgress ID="UpdateProgress2" runat="server">
<progresstemplate>
<asp:Label ID="Label20" runat="server" Font-Size="Large"
Text="Please Wait ...">
<img alt="" src ="images/Prog_2.gif"
style="width: 405px; height: 78px" />
|
In the run mode screen as follows
Studentfeedback form
Course ddlcourse Batch ddlbatch
When i select the ddl course in batch all batch details will be displayed and when i select the ddlbatch the gridview will not be displayed.
for that how can i do in asp.net using c#.