I have the req where am displaying my grid view with gridview select column(checkbox) by default.
After checking all the checkbox in a gridview am fetching the selected checkbox values and storing in a cookie.
After when i try to visit that particular grid i should see make see in a such a way that the gridview row that i selected before should be selected by default.
Here is the code i have used to bind the gridview by default.
otherinfoGrid.Columns.Clear();
otherinfoGrid.ItemsSource = null;
string selectcolumn = String.Format("Select", 0);
CheckBox chk = new CheckBox();
chk.Click += new RoutedEventHandler(CheckBox_Click);
GridViewSelectColumn columnselect = new GridViewSelectColumn();
columnselect.Width = GridViewLength.Auto;
columnselect.Header = chk;
otherinfoGrid.Columns.Add(columnselect);
string otherinfopropertyName13 = String.Format("OrderNo", 0);
GridViewDataColumn column13 = new GridViewDataColumn();
column13.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName13 };
column13.Header = otherinfopropertyName13;
otherinfoGrid.Columns.Add(column13);
string otherinfopropertyName = String.Format("Season", 0);
GridViewDataColumn column = new GridViewDataColumn();
column.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName };
column.Header = otherinfopropertyName;
otherinfoGrid.Columns.Add(column);
string otherinfopropertyName1 = String.Format("BuyingPrice", 0);
GridViewDataColumn column1 = new GridViewDataColumn();
column1.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName1 };
column1.Header = otherinfopropertyName1;
otherinfoGrid.Columns.Add(column1);
string otherinfopropertyName2 = String.Format("SellingPrice", 0);
GridViewDataColumn column2 = new GridViewDataColumn();
column2.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName2 };
column2.Header = otherinfopropertyName2;
otherinfoGrid.Columns.Add(column2);
string otherinfopropertyName6 = String.Format("Order Qty", 0);
GridViewDataColumn column6 = new GridViewDataColumn();
column6.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName6 };
column6.Header = otherinfopropertyName6;
otherinfoGrid.Columns.Add(column6);
string otherinfopropertyName3 = String.Format("Whole Sale Price(USD)", 0);
GridViewDataColumn column3 = new GridViewDataColumn();
column3.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName3 };
column3.Header = otherinfopropertyName3;
otherinfoGrid.Columns.Add(column3);
string otherinfopropertyName4 = String.Format("FOB%", 0);
GridViewDataColumn column4 = new GridViewDataColumn();
column4.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName4 };
column4.Header = otherinfopropertyName4;
otherinfoGrid.Columns.Add(column4);
string otherinfopropertyName5 = String.Format("COS%", 0);
GridViewDataColumn column5 = new GridViewDataColumn();
column5.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName5 };
column5.Header = otherinfopropertyName5;
otherinfoGrid.Columns.Add(column5);
string otherinfopropertyName51 = String.Format("Garmentdescription", 0);
GridViewDataColumn column51 = new GridViewDataColumn();
column51.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName51 };
column51.Header = otherinfopropertyName51;
otherinfoGrid.Columns.Add(column51);
string otherinfopropertyName53 = String.Format("Factory", 0);
GridViewDataColumn column53 = new GridViewDataColumn();
column53.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName53 };
column53.Header = otherinfopropertyName53;
otherinfoGrid.Columns.Add(column53);
string otherinfopropertyName54 = String.Format("Buyerdeldate", 0);
GridViewDataColumn column54 = new GridViewDataColumn();
column54.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName54 };
column54.Header = otherinfopropertyName54;
otherinfoGrid.Columns.Add(column54);
string otherinfopropertyName55 = String.Format("planship", 0);
GridViewDataColumn column55 = new GridViewDataColumn();
column55.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName55 };
column55.Header = otherinfopropertyName55;
otherinfoGrid.Columns.Add(column55);
string otherinfopropertyName52 = String.Format("Agency", 0);
GridViewDataColumn Agencycolumn = new GridViewDataColumn();
Agencycolumn.DataMemberBinding = new Binding() { Converter = new otherConverter(), ConverterParameter = otherinfopropertyName52 };
Agencycolumn.Header = otherinfopropertyName52;
otherinfoGrid.Columns.Add(Agencycolumn);
otherinfoGrid.ItemsSource = otherinfolistData;
while visiting again i already have the arraylist which i have stored the items in a cookie.
I should try to make sure that the gridview row items should match with my cookie value if so then select that particular row.
Please help me to achieve this.
Thanks
Regards
N.Balaji