|
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="true">
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90">
</ej:Column>
. . .
</Columns>
</ej:Grid>
|
Hi Trinh,
Thanks for contacting Syncfusion Support.
Query # 1:- my sql table have 2 column name: customerFirstname and customerLastname, now I want to bind these 2 values to 1 column name customerFullname in grid
We have checked your query and if you want to display 2 values in the single column Name you can display two values in single column name by using HeaderText property of the Grid. Please refer to the code example:-
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="true"><Columns><ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90"></ej:Column>. . .</Columns></ej:Grid>Please refer to the documentation Link:-
If we misunderstood your requirement, please share us the screenshot/Video Demo that could be helpful to provide you solution as early as possible.
Query#2 :- I want to show the customer's photo in grid using code behind (in .aspx.cs file, not by using template
We couldn’t achieve your requirement on code behind(in asp.cs file). You can render the image inside the Grid only by using Template column property of the Grid.
Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T
|
<script type="text/x-jsrender" id="columnTemplate">
<img style="width: 75px; height: 70px" src="../content/images/grid/Employees/{{:EmployeeID}}.png" alt="{{: EmployeeID }}" onerror="this.src='../content/images/grid/Employees/Spicy.png';" />
</script> |
Original :
|
John |
Mike |
Nick |
After cell merging:
|
John |
What I need is:
|
John Mike Nick |
|
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<script type="text/x-jsrender" id="columnTemplate">
{{:FirstName}} {{:LastName}}
</script>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.employeeView" is referred from jsondata.min.js
dataSource: ej.DataManager(window.employeeView).executeLocal(ej.Query().take(8)),
allowPaging: true,
columns: [
{ headerText: "Full Name", template: "#columnTemplate", textAlign: "center", width: 110 },
. . .
],
});
});
</script>
</body> |