Autogeneration is set to particular field.example group code.
after i delete or update that rows. the group code is not updated.
after i delete or update that rows. the group code is not updated.
//Global Variable
private static DataTable CountryStateCityTable=new DataTable();
page_load(...)
{
//Setting autopostback property to true so page is posted back to the server whenever an event is being fired.
this.CountryListBox.AutoPostBack=true;
this.StateListBox.AutoPostBack=true;
this.CityListBox.AutoPostBack=true;
//City,State,Country
CountryStateCityTable.Columns.Add("Country");
CountryStateCityTable.Columns.Add("State");
CountryStateCityTable.Columns.Add("City");
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Chennai"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Vellore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Koimbotore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Madurai"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Thiruchy"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Cochin"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Ernakulam"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Kolikode"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Bangalore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Mysore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Mangalore"});
CountryStateCityTable.Rows.Add(new string[]{"United States","New Jercy","New York"});
CountryStateCityTable.Rows.Add(new string[]{"United States","New Jercy","North Carolina"});
CountryStateCityTable.Rows.Add(new string[]{"United States","Colambia","Colambia City"});
CountryStateCityTable.Rows.Add(new string[]{"United States","Washington","Washington"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Sindhu","Islamabad"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Balusistan","Peshavur"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Balusistan","Hyderabad"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Punjab","Karachi"});
this.CountryListBox.DataSource=new DataView(this.CountryStateCityTable).ToTable(true,"Country").DefaultView;
this.CountryListBox.ValueMember="Country";
this.CountryListBox.DisplayMember="Country";
}
private void StateListBox_SelectedValueChanged(...)
{
try
{
DataView view=new DataView(this.CountryStateCityTable);
view.RowFilter="Country='"+this.CountryListBox.SelectedItem.Text+"' AND State='"+this.StateListBox.SelectedItem.Text+"'";
this.CityListBox.DataSource=viewToTable(true,"City").DefaultView;;
this.CityListBox.DisplayMember="City";
this.CityListBox.ValueMember="City";
}
catch(Exception exc)
{
Responce.Write(exc.Message);
}
}
private void CountryListBox_SelectedValueChanged(...)
{
try
{
DataView view=new DataView(this.CountryStateCityTable);
view.RowFilter="Country='"+this.CountryListBox.SelectedItem.Text+"'";
this.StateListBox.DataSource=view.ToTable(true,"State").DefaultView;
this.StateListBox.DisplayMember="State";
this.StateListBox.ValueMember="State";
}
catch(Exception exc)
{
Responce.Write(exc.Message);
}
}
//Global Variable
private static DataTable CountryStateCityTable=new DataTable();
page_load(...)
{
if(!IsPostBack)
{
//Setting autopostback property to true so page is posted back to the server whenever an event is being fired.
this.CountryListBox.AutoPostBack=true;
this.StateListBox.AutoPostBack=true;
this.CityListBox.AutoPostBack=true;
//City,State,Country
CountryStateCityTable.Columns.Add("Country");
CountryStateCityTable.Columns.Add("State");
CountryStateCityTable.Columns.Add("City");
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Chennai"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Vellore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Koimbotore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Madurai"});
CountryStateCityTable.Rows.Add(new string[]{"India","Tamilnadu","Thiruchy"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Cochin"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Ernakulam"});
CountryStateCityTable.Rows.Add(new string[]{"India","Kerala","Kolikode"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Bangalore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Mysore"});
CountryStateCityTable.Rows.Add(new string[]{"India","Karnataka","Mangalore"});
CountryStateCityTable.Rows.Add(new string[]{"United States","New Jercy","New York"});
CountryStateCityTable.Rows.Add(new string[]{"United States","New Jercy","North Carolina"});
CountryStateCityTable.Rows.Add(new string[]{"United States","Colambia","Colambia City"});
CountryStateCityTable.Rows.Add(new string[]{"United States","Washington","Washington"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Sindhu","Islamabad"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Balusistan","Peshavur"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Balusistan","Hyderabad"});
CountryStateCityTable.Rows.Add(new string[]{"Pakistan","Punjab","Karachi"});
this.CountryListBox.DataSource=new DataView(this.CountryStateCityTable).ToTable(true,"Country").DefaultView;
this.CountryListBox.ValueMember="Country";
this.CountryListBox.DisplayMember="Country";
}
}
private void StateListBox_SelectedValueChanged(...)
{
try
{
DataView view=new DataView(this.CountryStateCityTable);
view.RowFilter="Country='"+this.CountryListBox.SelectedItem.Text+"' AND State='"+this.StateListBox.SelectedItem.Text+"'";
this.CityListBox.DataSource=viewToTable(true,"City").DefaultView;;
this.CityListBox.DisplayMember="City";
this.CityListBox.ValueMember="City";
}
catch(Exception exc)
{
Responce.Write(exc.Message);
}
}
private void CountryListBox_SelectedValueChanged(...)
{
try
{
DataView view=new DataView(this.CountryStateCityTable);
view.RowFilter="Country='"+this.CountryListBox.SelectedItem.Text+"'";
this.StateListBox.DataSource=view.ToTable(true,"State").DefaultView;
this.StateListBox.DisplayMember="State";
this.StateListBox.ValueMember="State";
}
catch(Exception exc)
{
Responce.Write(exc.Message);
}
}
Comment