Query |
Syncfusion Comment | |
1. In my treegrid, one of the columns is the month data. When user edit the data in this column, I'd like to show them a dropdownlist populated with Jan, Feb....Dec, so they can choose one of these months. |
We can achieve this by setting editType as “dropdownedit” for the particular month colum. Code Snippet:
We have prepared a sample based on this and you can find the sample under the following location: Sample: http://www.syncfusion.com/downloads/support/forum/120550/ze/TreeGridSampleMVC1518107429
| |
2. Another column is for numeric data, but I'd like to restrict the number user input within 1 to 100.How can I accomplish these in treegrid? |
We can achieve this by Using “EndEdit” clientside event.
Code Snippet:
| |
3. Is there any way we can separate the header text into two rows? in that way, user can see all the text without increasing column size. It's kind of like the function of "wrap text" in excel. |
At Present there is no support to wrap a column text. For this we have already logged a feature request regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents |
Please let us know if you require further assistance on this.
Regards,
Dinesh kumar.N
But it did not work, how should I change the setting to get it work?
Thanks,
Harry
Hi Harry,
Query 1: if I do not want to create new month column, how should I accomplish the same goal?
Solution: We can render the drop down data with the data base column value, for that we need separate table with text and value field in it. Please refer the below code example for details.
[CS] public class TreeGridController : Controller { SqlCommand comm1 = new SqlCommand("SELECT * FROM Month", conn); SqlDataReader reader1 = comm1.ExecuteReader(); DataTable dt1 = new DataTable(); dt1.Load(reader1);
conn.Close();
Data data = new Data();
MonthTable = data.GetMonthRows(dt1);
ViewBag.month = MonthTable; }
public class MonthData { public string Id { get; set; } public string text { get; set; } public string value { get; set; } } |
Here we have populated the drop down data with other table named “Month” to the TreeGrid Column.
[CSHTML] @ (Html.EJ().TreeGrid("TreeGridContainer") .Columns(co => co.Field("Month").HeaderText("Month").EditType(TreeGridEditingType.Dropdown) .DropDownData((IEnumerable<object>) ViewBag.month).Add();
})) |
We have also prepared a sample based on this and you can find the sample under the following location.
Sample: http://www.syncfusion.com/downloads/support/forum/120550/ze/DropDownData2071115962
Regards,
Mahalakshmi K.
Hi Harry,
Thanks for the update.
Please let us know if you need further assistance on this.
Regards,
Mahalakshmi K.