I have a value starttime coming from database which is 12:20PM (for eg)
I want to retrieve it from db and store it to control
my sp is
Select LTRIM(RIGHT(CONVERT(VARCHAR(20),CAST(A.StdTimeIn as DATETIME)), 7)) as StdTimeIn from TimeMaster
M gettig error that collection is readonly.How to solve this
Loading
Sunny SharmaPosted Aug 10, 2013, 6:30 AM
Sunny SharmaPosted Aug 10, 2013, 5:56 AM
That's enough I needed. The problem is, you're trying to modify a readonly value in Request.Form Collection:
Request.Form["txtStartTimeHTML"] = objDataSet.Tables[0].Rows[0]["StdTimeIn"].ToString();
This will always raise the error that you're having now. Request.Form object contains all the properties of the submitting form and is readonly, so you can not modify this.
Instead, change the Text property of the TextBox like this:
txtStartTimeHTML.Text = objDataSet.Tables[0].Rows[0]["StdTimeIn"].ToString(); // I don't know what is the ID of the textbox so I assume it to be txtStartTimeHTML, change it if it's different.
That's all you need to do.
Happy Coding :)
Cheers!!
piyusha patravaliPosted Aug 10, 2013, 5:31 AM
Sunny I am using 3tier architecture so sending code is bit difficult. I have used this code to retrieve value from table when selected from gridview.
the code is
DataSet objDataSet = ob.GetData();
if (objDataSet != null && objDataSet.Tables.Count > 0)
{
Request.Form["txtStartTimeHTML"] = objDataSet.Tables[0].Rows[0]["StdTimeIn"].ToString();
}
Sunny SharmaPosted Aug 10, 2013, 2:12 AM
Seems a coding issue. Can you share your code behind or controller code?