Hi
I am getting error on below line - grdPlanning.Columns["SessionDate"].ReadOnly = false;
grdPlanning.DataSource = dt;
grdPlanning.Columns["SessionDate"].ReadOnly = false;
grdPlanning.DataBind();
Thanks
Hi
I am getting error on below line - grdPlanning.Columns["SessionDate"].ReadOnly = false;
grdPlanning.DataSource = dt;
grdPlanning.Columns["SessionDate"].ReadOnly = false;
grdPlanning.DataBind();
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ramco RamcoPosted May 5, 2023, 1:01 PM
Hi Jignesh
I have below code.
When i write below code it gives error - Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
grdPlanning.DataSource = dt;
((BoundField)grdPlanning.Columns[dt.Columns.Count - 1]).ReadOnly = false;
grdPlanning.DataBind();
Thanks
Jignesh KumarPosted May 5, 2023, 12:46 PM
Hello,
As Brahma prakash shukla indeicate that your gridview does not have "sessionDate" Column, I think in your previous post you have datatable with "Date" Name, please try below
Brahma Prakash ShuklaPosted May 5, 2023, 12:41 PM
The error you are encountering may be related to the fact that the "SessionDate" column does not exist in the grid or the data source.
To troubleshoot this issue, you can try the following:
Make sure that the "SessionDate" column exists in the data source (the DataTable "dt" in this case) and that it is spelled correctly.
Check if the "SessionDate" column is added to the grid before setting its ReadOnly property. You can do this by checking the Columns collection of the grid.
If the column exists, check if its ReadOnly property is set to true before trying to change it to false. Setting the ReadOnly property of a read-only column will raise an error.
If the above steps do not help, please provide more details about the error message you are receiving so that I can help you better.