We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Formula & Comments Storing in GBDG

Hi there, I would like to store the Formula & Comments in GBDG for each cell into the Database. I want these formula''s and comments needs to be retrieved from the database based user requests. How can you implement this please! I would appricate, if you could send me the sample code to store the formula and comments for each cell in the grid into database. Thanks Satish

3 Replies

AD Administrator Syncfusion Team April 12, 2004 08:08 AM UTC

The GridDataBoundGrid only stores the CellValue (or equivalently CellText) on a cell by cell basis as this is all that the DataSource provides. It does not, by default, store things like BackColor or FormulaTags or Tags or any of the other GridStyleInfo properties. If you want to use such properties on a cell by cell basis, then you have to maintain them yourself in some data store like an arraylist or hashtable or ???. You would then handle the Model.QueryCellInfo event to set your saved properties into e.Style based on the e.RowIndex and e.COlIndex passed in. Here is a forum link that discusses using formula cell in a GridDataBoundGrid. It has a sample attached. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2956 Here is a link to a KB article that discusses excel comments in a GridDataBoundGrid. It has a sample. http://www.syncfusion.com/Support/article.aspx?id=10369


SA Satish April 13, 2004 01:59 AM UTC

Hi, I read the below statement which mentioned in the http://www.syncfusion.com/Support/article.aspx?id=10439 URL. -------------------------------------- The reason is that in a GridDataBoundGrid, there is nothing stored in the grid on a cell by cell basis. The only cell specific information that is available is the value (which comes from the datasource and is not stored in the grid). So, if you want to use formulas in a GridDataBoundGrid, then you must provide the formula and also provide the FormulaTag, both on a cell basis. Attached is a sample (VB.NET and C#) that uses the Model.QueryCellInfo event handler to provide the formula (generated in the handler dynamically), and to provide the FormulaTag (saved in an arraylist). It also handles the Model.SaveCellInfo event to make sure the FormulaTag information is updated properly. ------------------- My Question is I dont know in the beginning what formula i will be using. So it diffcult for me to add the formula to the formula tag before adding the record. ------------- I have created table called ''ORDER_PROCESSING'' which has got about 5 fields in table. ex. 1. ORDER_NO 2. ORDER_DATE 3. RATE 4. FORMULA This table is bind with the Databoundgrid. Now user wants to create a new record by pressing ''Add'' button row will be created and made ''RATE'' Field as Formula Cell type. User enters ex. ''=COS(10)'' in the rate field, i should get the value 0.985 in the Rate field and ''=COS(10)'' formula should be updated into ''Formula'' Field in the table. Like this user can enter many records with different formulas. Please let me know if you have sample formula database application Thanks Satish >The GridDataBoundGrid only stores the CellValue (or equivalently CellText) on a cell by cell basis as this is all that the DataSource provides. It does not, by default, store things like BackColor or FormulaTags or Tags or any of the other GridStyleInfo properties. If you want to use such properties on a cell by cell basis, then you have to maintain them yourself in some data store like an arraylist or hashtable or ???. You would then handle the Model.QueryCellInfo event to set your saved properties into e.Style based on the e.RowIndex and e.COlIndex passed in. > >Here is a forum link that discusses using formula cell in a GridDataBoundGrid. It has a sample attached. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=2956 > >Here is a link to a KB article that discusses excel comments in a GridDataBoundGrid. It has a sample. http://www.syncfusion.com/Support/article.aspx?id=10369


AD Administrator Syncfusion Team April 13, 2004 07:13 AM UTC

You do not have to add the FormulaTag until you know what you want to add. In your case, you would add it in your Add Button handler. Are Rate and Formula loaded from, and saved to, your DataBase? If so, you could try setting the GridBoundColumn.StyleInfo.CellType for Rate column to be "FormulaCell". If they are not columns in your DataBase, then are they to be considered unbound columns that will not be persisted anywhere? Another option you could use is to use Expression columns directly in your DataTable. This way, the DataTable will handle the calculations, and the grid will just display the columns like they were just any other column. Anyway, here is a sample doing what you described, adding a new row when you click a button. forum12973_2054.zip

Loader.
Live Chat Icon For mobile
Up arrow icon