About string conversion in DataGrid

xiaoxiao2021-03-06  83

In DataGrid, when the data is bound, how to output the string in the database according to the way you set, it is a more trouble of this problem, I have been a long time, and I also tried many methods: 1.

 <% # container.dateItem ("Field Name")  browser can automatically put the carriage return according to 
 attributes, but the paragraph without carriageway will become long long. A big line, N long did not solve this contradiction, because the browser in 
 enforces the string to walk, and there is no automatic wrap. 2. Use the  control to install the content within the database, so that the automatic wrap is guaranteed, it can be shipped back to the bank, but you ask you to set the property, such as the scroll bar, border, read only. But in this way, the volume is large, and the right button on TextBox is not normal, such as: There is no common retreat, copying shortcut link, etc., is not convenient 3. The string to be formatted first in the DataSet is first converted, and then bundle it. But in this way, the data in DS is traveled first. Create a conversion function first in the .cs file, such as: public string turnstring (string _str) {/ * Processing * / return_string;} Calling <% # Turnstring in DataGrid (Container.DataItem ("Field Name") )%> Individual feels that this method can be considered. But the Turnstring function is to be in the current page or the CS file associated with the current page, but you can predefine the format method, (in the DLL), then Turnstring calls the object, can do the same and maintainability I use it now is 4. If you find a good method later, you will be submitted here. If someone has a better way, please let me know. . Thank you! ! Different opinions, please advise me, just learn. Net is not very understanding. My method is the test. I only explain my ideas. If you don't know clear, please contact me Huangguolinc @ 163.com

转载请注明原文地址:https://www.9cbs.com/read-106886.html

New Post(0)