Sorry I don't mean to cross post, but i sent this to another c# list with no response, normally they do respond in the day, but i am desperate for an answer, so please accept my apology.
 
Note: the commented lines in the code i included in this email, are lines that I have tried with no success, and i also looked at the article below:
 
Well basically i have a dropdown list in a datagrid, I am trying to get the SelectedIndex or SelectedValue of the new selected item, but...in my code, it always gets the orginal value ignoring the new selected value for the strForeignKey ...well, i have the following function:
 
 
 

      private void dgAccessRights_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)

            {

                  if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem ||e.Item.ItemType == ListItemType.EditItem)

                  {

                          

                        LinkButton lbRep = (LinkButton)e.Item.Cells[2].Controls[0];

                        string strPrimaryKey = lbRep.Text;

 

                        LinkButton lbAccess = (LinkButton)e.Item.Cells[4].Controls[0];

                        string strForeignKey = lbAccess.Text;

           

                        clsMDMS objMDMS = new clsMDMS();

                        DropDownList ddl = (DropDownList)e.Item.FindControl("cmb_Access_Right");

                                    //ddl.Attributes.Add("OnSelectedIndexChanged","return confirm('Are you sure you wish to delete this item?');");

 

     

                        objMDMS.PopulateDropDown("wc_Access_Rights_List",ddl,"Please Select Access Right.");

                 

                                       

 

                        ddl.SelectedIndex = ddl.Items.IndexOf( ddl.Items.FindByValue(strForeignKey));

 

                        string strEditedValue = ((DropDownList)e.Item.FindControl("cmb_Access_Right")).SelectedIndex.ToString();

                 

                       

                        //ddl.Attributes["OnChange"]="_javascript_:Prompt2Save('" + strPrimaryKey.ToString() + "','" + strEditedValue + "');";

                        //ddl.Attributes["OnChange"]="dgAccessRights_SelectedIndexChanged";

                       

                             

                  }

 

            }

 


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to