Actually i am binding my types of fees of a particular student to dropdown list(ddlFeeType).up to this it is working fine but while selecting the particular fee from dropdown list it is not selecting the particular fee here below is my code for full page.which is necessary for this
here the page will open with search text_box1. after entering the name(or)reg_id it will display the record according to the name(or)reg_id in a grid_view1 after clicking on the reg_id of a student which is displayed on the grid_view1.according to that reg_id i will bind the fee_types to the drop down(ddlfeetype).here down i am giving reg_id link button code and binding the fee types to ddlfeetypes.
//link button code
protected void lblStudent_ID_Click(object sender, EventArgs e)
{
LinkButton lbtn = (LinkButton)sender;
Session["lbtnStudent_id"] = Convert.ToString(lbtn.Text);
PickFeesofParticularID();
}
//this is the function for binding the fee_types to drop down list
public void PickFeesofParticularID()
{
SqlCommand cmdPickFeeses = DBManager.DataAccess.command();
cmdPickFeeses.Parameters.Add(new SqlParameter("@option", SqlDbType.VarChar, 50));
cmdPickFeeses.Parameters["@option"].Value = "PickFeesesOfParticularID";
cmdPickFeeses.Parameters.Add(new SqlParameter("@Student_ID", SqlDbType.VarChar, 50));
cmdPickFeeses.Parameters["@Student_ID"].Value = Session["lbtnStudent_id"].ToString();
string sqlquery = "SchoolProc";
DataSet dsPickFees = DBManager.DataAccess.getdata(sqlquery);
if (dsPickFees.Tables[0].Rows.Count > 0)
{
ddlFeeTypes.DataSource = dsPickFees.Tables[0];
ddlFeeTypes.DataTextField = "Fee_Type";
ddlFeeTypes.DataValueField = "Annual_Month";
ddlFeeTypes.DataBind();
ddlFeeTypes.Items.Insert(0, "--Select--");
panelSearch.Visible = false;
PanelFeeTypes.Visible = true;
lblSelectMonth.Visible = false;
ddlMonth.Visible = false;
gridviewCandidateDetails.Visible = false;
panelAllFeeDetails.Visible = false;
}
}
//this the code for ddlFeeTypes_SelectedIndexChanged
protected void ddlFeeTypes_SelectedIndexChanged(object sender, EventArgs e)
{
string Fee_type = ddlFeeTypes.SelectedIndex.ToString();
ViewState["Fee_type"] = Fee_type;
SqlCommand cmdPickMonthYear = DBManager.DataAccess.command();
cmdPickMonthYear.Parameters.Add(new SqlParameter("@option", SqlDbType.VarChar, 50));
cmdPickMonthYear.Parameters["@option"].Value = "PickMonthYear";
cmdPickMonthYear.Parameters.Add(new SqlParameter("@Annual_Month", SqlDbType.Bit));
cmdPickMonthYear.Parameters["@Annual_Month"].Value = ddlFeeTypes.SelectedValue;
string sqlquery = "SchoolProc";
DataSet dsPickMonthYear = DBManager.DataAccess.getdata(sqlquery);
if (dsPickMonthYear.Tables[0].Rows.Count > 0)
{
ddlMonth.DataSource = dsPickMonthYear.Tables[0];
ddlMonth.DataTextField = "Annual_month";
ddlMonth.DataValueField = "Annual_month";
ddlMonth.DataBind();
panelSearch.Visible = false;
PanelFeeTypes.Visible = true;
gridviewCandidateDetails.Visible = false;
ddlMonth.Visible = true;
lblSelectMonth.Visible = true;
panelAllFeeDetails.Visible = false;
}
else
{
}
}
//here i am unable to display full code and may be i am unable to ask properly it is my fault..