问题描述
受保护的 void drpClaimNumber_SelectedIndexChanged(对象发件人,EventArgs e) { int claimId = int .Parse(drpClaimNumber.SelectedValue.ToString()); cmd = 新 SqlCommand(" Edit_ClaimDetails" ,con1); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(" @ Claim_Id" ,SqlDbType.VarChar).Value = ClaimId; con1.Open(); cmd.Connection = con1; SqlDataAdapter ada = 新 SqlDataAdapter(cmd); ada.Fill(ds); { 如果(ds.Tables [ 0 ].Rows.Count > 0 ) { txtFirstName.Text = ds.Tables [ 0 ].行[ 0 ] [" 名字"].ToString(); txtLastName.Text = ds.Tables [ 0 ].行[ 0 ] [" 姓氏"].ToString(); txtAddress.Text = ds.Tables [ 0 ].行[ 0 ] [" 地址1"].ToString(); txtPolicyNumber.Text = ds.Tables [ 0 ].rows [ 0 ] [" policy_number"].ToString(); txtDateOfLoss.Text = ds.Tables [ 0 ].Rows [ 0 ] [" date_of_loss"].ToString(); txtAdditionalDetails.Text = ds.Tables [ 0 ].rows [ 0 ] [" additional_details"].ToString(); 字符串 sel_policy = ds.Tables [ 0 ].行[ 0 ] [" policy_description" ].ToString(); int indx1 = drpPolicyType.Items.IndexOf(drpPolicyType.Items.FindByText(sel_policy)); drpPolicyType.SelectedIndex = indx1; 字符串 sel_claims = ds.Tables [ 0 ].行[ 0 ] [" claims_description" ].ToString(); int indx2 = drpClaimType.Items.IndexOf(drpClaimType.Items.FindByText(sel_claims)); drpClaimType.SelectedIndex = indx2; } con1.Close(); } }
请检查此代码.实际上以我的形式他们是2 drpdown
一个.政策类型
b.索赔类型
声明类型drpdown与策略类型有关.
现在我正在编辑零件.
当我选择任何索赔编号时,它会在各个文本框和下拉列表中显示所有详细信息.但是问题是当我选择任何索赔编号时,我无法查看我的表格中接受索赔类型drpdown"的每个字段.在保单类型drpdown中,我可以在选择无要求后查看顶部,但是我无法查看索赔类型drpdown说明.我选择了policytype drpdwn autopostback属性true.
请告诉我,如何根据所选的索赔编号查看索赔类型下拉列表.
:((:sigh::confused :: confused:
protected void drpClaimNumber_SelectedIndexChanged(object sender, EventArgs e) { int claimId = int.Parse(drpClaimNumber.SelectedValue.ToString()); cmd = new SqlCommand("Edit_ClaimDetails", con1); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Claim_Id", SqlDbType.VarChar).Value = claimId; con1.Open(); cmd.Connection = con1; SqlDataAdapter ada = new SqlDataAdapter(cmd); ada.Fill(ds); { if (ds.Tables[0].Rows.Count > 0) { txtFirstName.Text = ds.Tables[0].Rows[0]["First_name"].ToString(); txtLastName.Text = ds.Tables[0].Rows[0]["Last_name"].ToString(); txtAddress.Text = ds.Tables[0].Rows[0]["Address1"].ToString(); txtPolicyNumber.Text = ds.Tables[0].Rows[0]["policy_number"].ToString(); txtDateOfLoss.Text = ds.Tables[0].Rows[0]["date_of_loss"].ToString(); txtAdditionalDetails.Text = ds.Tables[0].Rows[0]["additional_details"].ToString(); string sel_policy = ds.Tables[0].Rows[0]["policy_description"].ToString(); int indx1 = drpPolicyType.Items.IndexOf(drpPolicyType.Items.FindByText (sel_policy )); drpPolicyType.SelectedIndex = indx1; string sel_claims = ds.Tables[0].Rows[0]["claims_description"].ToString(); int indx2 = drpClaimType.Items.IndexOf(drpClaimType.Items.FindByText(sel_claims)); drpClaimType.SelectedIndex = indx2; } con1.Close(); } }
please check this code . actually in my form their are 2 drpdown
a. policy type
b. claim type
claim type drpdown is related to policy type .
now i am working on editing part.
when i select any claim number than it shows all the details in various textboxes and dropdowns. but the problem is when i select any claim number than i am able to view every feild in my form accept in claim type drpdown. in policy type drpdown i can view on the top after selcting claim no but i am not able to view claim type drpdown description. i selected policytype drpdwn autopostback property true.
please tell me that how i can view in claim type dropdown also according to the selected claim no.
:(( :sigh: :confused::confused:
这篇关于查看下拉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!