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

Grid not posting back.

Hi, 

Just a quick question, I'm new to syncfusion controls, and basically just want to upgrade some grids from previously build applications. 

Now I've started a new project and can't get the grid to post back at all, only once I convert to a syncfusion application it works. 

Problem is I don't necessarily want all the extra data etc on my application. Can you please explain to me the methods of enabling post back, I would like achieve this in asp and not code behind. 

I'm using a SQLDataSource with two simple sql procedures pulling an EmployeeID and Email address. I have enabled the toolbar for "edit,update,cancel,save"

Even with this simple example I cannot get it to postback.

Your help will be appreciated. (Please ASP as far as possible.)

Hopefully its something small somewhere, else please let me know what you need from my side.

Regards.



13 Replies

MR MrT September 28, 2016 06:46 AM UTC

Do I maybe need a script manager with a update panel? 

Please advise as I don't want unnecessary panels, just want to understand before I continue.


MR MrT September 28, 2016 08:28 AM UTC

Doesn't seem to work even with a script manager and update panel, sure I'm missing something small somewhere... 

CONTENT PAGE:

<%@ Page Title="" Language="VB" MasterPageFile="~/HelpDeskMaster.master" AutoEventWireup="false" CodeFile="Employee.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="Syncfusion.EJ.Web, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>

<%@ Register assembly="Syncfusion.EJ, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Models" tagprefix="ej" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <ej:Grid ID="Grid1" runat='server' CssClass="" DataSourceCachingMode="None" DataSourceID="SqlDataSource1" MinWidth="0">
        <ToolbarSettings ShowToolbar="True" ToolbarItems="edit,update,cancel ,save"></ToolbarSettings>
        <Columns>
            <ej:Column AllowEditing="False" DataType="number" Field="EmployeeID" IsIdentity="True" IsPrimaryKey="True">
            </ej:Column>
            <ej:Column DataType="string" Field="Email">
            </ej:Column>
        </Columns>
<PageSettings Template=""></PageSettings>

        <EditSettings AllowEditing="True" />

<RowDropSettings DropTargetID="" DropMapper=""></RowDropSettings>

<SearchSettings></SearchSettings>

<ScrollSettings EnableTouchScroll="False"></ScrollSettings>
    </ej:Grid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" SelectCommand="sp_EmailSelect" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        
</asp:Content>


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

MASTER PAGE:

<%@ Master Language="VB" CodeFile="HelpDeskMaster.master.vb" Inherits="HelpDeskMaster" %>

<%@ Register Assembly="Syncfusion.EJ.Web, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!--Bootstarp Style Sheet -->
    <link rel='nofollow' href="Bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <!--SyncFusion Style Sheet -->
    <link rel='nofollow' href="SyncFusion/Content/default-theme/ej.web.all.min.css" rel="stylesheet" />
    <link rel='nofollow' href="SyncFusion/Content/default-theme/ej.widgets.all.min.css" rel="stylesheet" />
    <!--SyncFusion(Java) Scripts -->
    <script src="SyncFusion/Scripts/jquery-2.1.4.min.js"></script>
    <script src="SyncFusion/Scripts/jquery.easing.1.3.min.js"></script>
    <script src="SyncFusion/Scripts/jsrender.min.js"></script>
    <script src="SyncFusion/Scripts/ej.web.all.min.js"></script>
    <!--Bootstarp Script -->
    <script src="Bootstrap/js/bootstrap.min.js"></script>

    <title>HelpdeskWebApplication</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
                </ContentTemplate>
            </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>




Please let me know if you see something.


MR MrT September 28, 2016 09:32 AM UTC

Hi, I got it thanks.

I was setting my UPDATE procedure in the front end but it did not update the asp, I have manually added the update parameters: 

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" SelectCommand="sp_EmailSelect" SelectCommandType="StoredProcedure" UpdateCommand="sp_EmailUpdate" UpdateCommandType="StoredProcedure">
        <UpdateParameters>
            <asp:Parameter Name="EmployeeID" Type="Int32" />
            <asp:Parameter Name="Email" Type="String" />
        </UpdateParameters>
</asp:SqlDataSource>

Its working now.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team September 29, 2016 12:17 PM UTC

Hi SmurofNeves, 

We are happy to hear that your issue has been resolved.  

We have also noticed your application is missing the ej.webform.min.js. Check the following KB for essentials of ej.webforms.min.js. 
  

Refer the following Help documents for server events. 


Regards, 
Seeni Sakthi Kumar S. 



MR MrT September 29, 2016 12:32 PM UTC

Hi Seeni, 

Do you advise I remove the "ej.web.all.min.js" and replace it with the "ej.webform.min.js"? 

I don't understand why the ej.webform.min.js is needed as its working now without it? Is there a performance difference? Or do I just need both for some reason? 

Then another thing I just want to bring to your attention, your grid toolbar documentation has the items starting with a Capital:
Add
Edit
Delete
Update
Cancel
Save

Problem is, copying it like that doesn't work, it has to be lowercase in order to work. 
(Just thought I mention it since I struggled for a while to figure this out as I copied from the online documentation)

Please advise. 

Kind Regards.




MR MrT September 29, 2016 01:48 PM UTC

Sorry, One more thing.... 

Is it possible for me to set the GRID dropdowns to a specific sqldatasouce using asp? 

I'm already using one sqldatasource for the grid, but need to add another two for my grid dropdowns. (I see the "datasource" option is greyed out from the GUI side.)

I've highlighted the two columns which I need to link to the datasources in yellow below. :-)

I've added a new sqldatasource( SqlDataSource2), this contains the sql stored procedure for my dropdown on column "DEPARTMENT". 

Please see code below: 

<ej:Grid ID="Grid1" runat='server' CssClass="" DataSourceCachingMode="None" DataSourceID="SqlDataSource1" MinWidth="0" Visible="False" AllowPaging="True">
                <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel,save">
                </ToolbarSettings>
                <Columns>
                    <ej:Column AllowEditing="False" DataType="number" Field="EmployeeID" IsIdentity="True" IsPrimaryKey="True" Visible="False" ForeignKeyField="" ForeignKeyValue="">
                    </ej:Column>
                    <ej:Column DataType="number" Field="DepartmentID" Visible="False" ForeignKeyField="" ForeignKeyValue="">
                    </ej:Column>
                    <ej:Column DataType="number" Field="EmployeeTypeID" Visible="False" ForeignKeyField="" ForeignKeyValue="">
                    </ej:Column>
                    <ej:Column DataType="number" Field="InActiveFlag" Visible="False">
                    </ej:Column>
                    <ej:Column DataType="string" Field="FirstName" ForeignKeyField="" ForeignKeyValue="">
                    </ej:Column>
                    <ej:Column DataType="string" Field="LastName" ForeignKeyField="">
                    </ej:Column>
                    <ej:Column DataType="string" Field="Email" ForeignKeyField="">
                    </ej:Column>
                    <ej:Column DataType="string" Field="Department" EditType="Dropdown" ForeignKeyField="Department" ForeignKeyValue="DepartmentID">
                    </ej:Column>
                    <ej:Column DataType="string" Field="PhoneExt" ForeignKeyField="">
                    </ej:Column>
                    <ej:Column DataType="string" Field="EmployeeType" EditType="Dropdown" ForeignKeyField="EmployeeType" ForeignKeyValue="EmployeeTypeID">
                    </ej:Column>
                </Columns>
<PageSettings Template=""></PageSettings>

                <EditSettings AllowAdding="True" AllowDeleting="True" AllowEditing="True" />

<RowDropSettings DropTargetID="" DropMapper=""></RowDropSettings>

<SearchSettings></SearchSettings>

<ScrollSettings EnableTouchScroll="False"></ScrollSettings>
            </ej:Grid>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" DeleteCommand="sp_EmployeeDelete" DeleteCommandType="StoredProcedure" InsertCommand="sp_EmployeeNewInsert" InsertCommandType="StoredProcedure" SelectCommand="sp_EmployeeDetailSelect" SelectCommandType="StoredProcedure" UpdateCommand="sp_DepartmentDetailUpdate" UpdateCommandType="StoredProcedure">
                <DeleteParameters>
                    <asp:Parameter Name="EmployeeID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="InActiveFlag" Type="Boolean" />
                    <asp:Parameter Name="FirstName" Type="String" />
                    <asp:Parameter Name="LastName" Type="String" />
                    <asp:Parameter Name="Email" Type="String" />
                    <asp:Parameter Name="DepartmentID" Type="Int32" />
                    <asp:Parameter Name="PhoneExt" Type="String" />
                    <asp:Parameter Name="EmployeeTypeID" Type="Int32" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="DepartmentID" Type="Int32" />
                    <asp:Parameter Name="InActiveFlag" Type="Boolean" />
                    <asp:Parameter Name="Description" Type="String" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" SelectCommand="sp_DepartmentDropDown" SelectCommandType="StoredProcedure"></asp:SqlDataSource>


Thank you in advance. 

Kind Regards.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team September 30, 2016 10:39 AM UTC

Hi SmurofNeves, 

Query #1: I don't understand why the ej.webform.min.js is needed as its working now without it? Is there a performance difference? 

To trigger the server-side events like OnServerAddRow and other server events, ej.webform.min.js must be referred along with the ej.web.all.min.js. The same has been discussed in the following KB. 


Query #2: Grid toolbar documentation has the items starting with a Capital 

In the following toolbar Help Document for ASP Grid, table list outs the default toolbar items in the Grid and they are names of the tools. The Syntax for the toolbar items has been shown in the HTML Tab below the tabulation. 


Query #3: Is it possible for me to set the GRID dropdowns to a specific sqldatasouce using asp 

We cannot directly bind the SqlDataSource directly to the Grid columns but we can do them in the code behind. Refer to the following code example. 

    <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="true"> 
        <Columns> 
            <ej:Column Field="OrderID" IsPrimaryKey="true" HeaderText="Order ID"> 
            </ej:Column> 
            <ej:Column Field="CustomerID" HeaderText="Customer ID"> 
            </ej:Column> 
            <ej:Column Field="EmployeeID" ForeignKeyField="EmployeeID" ForeignKeyValue="FirstName"> 
            </ej:Column> 
              . . . . 
            </ej:Column> 
        </Columns> 
              . . 
    </ej:Grid> 
 
    <asp:SqlDataSource 
        ID="dropData" 
        runat="server" 
        ConnectionString="<%$ ConnectionStrings:SQLConnectionString%>" 
        SelectCommand="SELECT * FROM Employees"></asp:SqlDataSource> 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
 
            DataView dv = (DataView)this.dropData.Select(DataSourceSelectArguments.Empty); 
            DataTable dt = dv.ToTable(); 
 
 
            var result = (from rw in dt.AsEnumerable() 
                         select new 
                         { 
                             EmployeeID = Convert.ToInt32(rw["EmployeeID"]), 
                             FirstName = Convert.ToString(rw["FirstName"]) 
                         }).ToList(); 
            this.OrdersGrid.Columns[2].DataSource = result;//EmployeeID Column ==> Column Index = 2 
        } 


Refer to the following Online demo and Help Document on ForeignKey column 


Regards, 
Seeni Sakthi Kumar S. 



MR MrT September 30, 2016 01:30 PM UTC

Hi Seeni, 

Thank you for your response. 

Is there no way of creating a template column and using the drop down control manually, meaning to specify a datasource for each drop down control in the grid template columns. (Not using the grid dropdown but the actual drop down control.)

It doesn't seem practical to have all that code behind on page load. Not only that, but the code you provided results in a circular reference. 

Please advise.










MR MrT October 3, 2016 09:46 AM UTC

Hi Seeni, 

Is it not possible for you to provide me with an example where a syncfusion gird uses one datasource to populate, with a dropdown list inside one of the grid cells, using another sql datasource? 

This way I might be able to reverse engineer it. Too thus far I have not been able to succeed, I have tried multiple methods but don't seem to have enough exp. 

Maybe a simple example like: 

Datasource 1 for grid population:    EmployeeID, Name, Surname, City 

Datasource 2 for grid dropdown displaying list of cities:    CityID, City

Please see if you can provide me the code for a simple grid using datasource 1 BUT where the dropdown is working using datasource 2 displaying a list of cities. 

As previously stated I use SQL STORED PROCEDURES and would need grids to have around 5 dropdowns like "CITY" populate from each their own datasource. (different DB tables etc.) 

There must be an easier way, looking forward to your example. 

Thank you again for your time. 

Kind Regards.



SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team October 3, 2016 01:37 PM UTC

Hi SmurofNeves, 

We are unable to reproduce the problem at our end.  

We have prepared a sample that can be downloaded from the following location. 


If you are still facing any issue, please provide the following information to analyze the issue and provide you solution as early as possible. 

1)      Code example of the Grid and code behind 
2)      Screenshot for the issue 
3)      If possible, modify the attached sample and replicate the issue. 

Regards, 
Seeni Sakthi Kumar S. 



MR MrT October 5, 2016 07:57 AM UTC

Morning Seeni, 

I have prepared a new test page with a grid and two dropdown columns with two specific sqldatasources and wrote the select queries in so you can see them. 

Please help me with the code behind inorder to make this function correctly, I have tried multiple times but failed.

MASTERPAGE:

<%@ Master Language="VB" CodeFile="HelpDeskMaster.master.vb" Inherits="HelpDeskMaster" %>

<%@ Register Assembly="Syncfusion.EJ.Web, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!--Bootstarp Style Sheet -->
    <link rel='nofollow' href="Bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <!--SyncFusion Style Sheet -->
    <link rel='nofollow' href="SyncFusion/Content/default-theme/ej.web.all.min.css" rel="stylesheet" />
    <link rel='nofollow' href="SyncFusion/Content/default-theme/ej.widgets.all.min.css" rel="stylesheet" />
    <script src="Scripts/ej/ej.webform.min.js"></script>
    <!--Animation Style Sheet -->
    <link rel='nofollow' href="Animation/animate.min.css" rel="stylesheet" />
    <!--SyncFusion(Java) Scripts -->
    <script src="SyncFusion/Scripts/jquery-2.1.4.min.js"></script>
    <script src="SyncFusion/Scripts/jquery.easing.1.3.min.js"></script>
    <script src="SyncFusion/Scripts/jsrender.min.js"></script>
    <script src="SyncFusion/Scripts/ej.web.all.min.js"></script>
    <!--Bootstarp Script -->
    <script src="Bootstrap/js/bootstrap.min.js"></script>

    <title></title>
    <style>
.J1
        {
            background-image:url(Images/Helpdesk.png);
            background-size: cover;
             text-decoration-color: deepskyblue;
            background-repeat: no-repeat;
            text-align:center;
            background-position: 0px -50px;
            margin-bottom:0px;
            color:cornflowerblue;
            text-shadow: black 0.3em 0.3em 0.3em;
        }
.J2
        {
            background-image:url(Images/MagnifyGIF.GIF);
            background-position:left;
            background-repeat: no-repeat;
            text-align:center;
            background-position: 0px 0px;
            background-size:10%;
            margin-bottom:0px;
            color:cornflowerblue;
            margin-bottom:500px;
        }
.J3
        {
            background-image:url(Images/GearsGIF.GIF);
            background-position:left;
            background-repeat: no-repeat;
            text-align:center;
            margin-bottom:500px;
            background-position: 0px 0px;
            background-size:20%;
            color:cornflowerblue;
        }
.J4
        {
            background-image:url(Images/TypingOnLaptopGIF.GIF);
            background-position:left;
            background-repeat: no-repeat;
            text-align:center;
            background-position: 0px 0px;
            background-size:20%;
            color:cornflowerblue;
            margin-bottom:500px;
        }
.btn1 {
  background: #3498db;
  background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
  background-image: -moz-linear-gradient(top, #3498db, #2980b9);
  background-image: -o-linear-gradient(top, #3498db, #2980b9);
  background-image: linear-gradient(to bottom, #3498db, #2980b9);
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  animation: bounce 2s ease 5s normal;
  border-radius: 28px;
  font-family: Arial;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  text-decoration: none;
}

.btn1:hover {
  background: #3cb0fd;
  background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
  background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
  background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
  text-decoration: none;
}
body
{
background-image:url(Images/BG-3.jpg);
background-repeat: no-repeat;
background-position:center;
background-size: cover;
height:100%;
background-size:100% 100%;
}
    </style>
</head>
<body>
    <div class="container">
        <div class="jumbotron J1">
            <h1 class="animated bounce">Helpdesk Dashboard</h1>
        </div>
    </div>
    <div class="container">
        <div =class="jumbotron">
    <ej:Menu ID="Menu1" runat="server">
        <Items>
            <ej:MenuItem ID="EmployeePage" Text="Employees" Url="Employee.aspx">
                <Items>
                    <ej:MenuItem ID="EmployeeSub1" Text="Quick Find" Url="Employee.aspx">
                        <Items>
                            <ej:MenuItem ID="EmployeeSubSub1" Text="Create New Employee" Url="Employee.aspx">
                            </ej:MenuItem>
                            <ej:MenuItem ID="EmployeeSubSub2" Text="Remove Employee" Url="Employee.aspx">
                            </ej:MenuItem>
                        </Items>
                    </ej:MenuItem>
                </Items>
            </ej:MenuItem>
            <ej:MenuItem ID="DepartmentPage" Text="Departments" Url="Department.aspx">
                <Items>
                    <ej:MenuItem ID="DepartmentSub" Text="Quick Find" Url="Department.aspx">
                        <Items>
                            <ej:MenuItem ID="DepartmentSubSub1" Text="Create New Department" Url="Department.aspx">
                            </ej:MenuItem>
                            <ej:MenuItem ID="DepartmentSubSub2" Text="Remove Department" Url="Department.aspx">
                            </ej:MenuItem>
                        </Items>
                    </ej:MenuItem>
                </Items>
            </ej:MenuItem>
            <ej:MenuItem ID="CatagoryPage" Text="Catagory" Url="Catagory.aspx">
                <Items>
                    <ej:MenuItem ID="CatagorySub1" Text="Quick Find" Url="Catagory.aspx">
                        <Items>
                            <ej:MenuItem ID="CatagorySubSub1" Text="Create New Catagory" Url="Catagory.aspx">
                            </ej:MenuItem>
                            <ej:MenuItem ID="CatagorySubSub2" Text="Remove Catagory" Url="Catagory.aspx">
                            </ej:MenuItem>
                        </Items>
                    </ej:MenuItem>
                </Items>
            </ej:MenuItem>
        </Items>
    </ej:Menu>
        </div>
        </div>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"></asp:ContentPlaceHolder>
    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
    </form>
</body>
</html>


ASPX(GRIDDROP) (TESTPAGE):

<%@ Page Title="" Language="VB" MasterPageFile="~/HelpDeskMaster.master" AutoEventWireup="false" CodeFile="GridDROP.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="Syncfusion.EJ.Web, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>

<%@ Register assembly="Syncfusion.EJ, Version=14.2460.0.26, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" namespace="Syncfusion.JavaScript.Models" tagprefix="ej" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <div>
            <ej:Grid ID="Grid1" runat='server' CssClass="" DataSourceCachingMode="None" DataSourceID="GridSource" MinWidth="0" AllowPaging="True">
                <Columns>
                    <ej:Column AllowEditing="False" DataType="number" Field="EmployeeID" IsIdentity="True" IsPrimaryKey="True" Visible="False">
                    </ej:Column>
                    <ej:Column DataType="number" Field="DepartmentID" Visible="False" AllowEditing="False">
                    </ej:Column>
                    <ej:Column DataType="number" Field="EmployeeTypeID" Visible="False" AllowEditing="False">
                    </ej:Column>
                    <ej:Column DataType="number" Field="InActiveFlag" Visible="False" HeaderTextAlign="Center">
                    </ej:Column>
                    <ej:Column DataType="string" Field="FirstName" HeaderTextAlign="Center">
                    </ej:Column>
                    <ej:Column DataType="string" Field="LastName" HeaderTextAlign="Center">
                    </ej:Column>
                    <ej:Column DataType="string" Field="Email" HeaderTextAlign="Center">
                    </ej:Column>
                    <ej:Column DataType="string" Field="Department" EditType="Dropdown" HeaderTextAlign="Center" ForeignKeyField="DepartmentDescription" ForeignKeyValue="DepartmentID">
                        <EditTemplate Create="create" Read="read" Write="write" />
                    </ej:Column>
                    <ej:Column DataType="string" Field="PhoneExt" HeaderTextAlign="Center">
                    </ej:Column>
                    <ej:Column DataType="string" Field="EmployeeType" EditType="Dropdown" HeaderTextAlign="Center" ForeignKeyField="EmployeeType" ForeignKeyValue="EmployeeTypeID">
                        <EditTemplate Create="create" Read="read" Write="write" />
                    </ej:Column>
                </Columns>
<PageSettings></PageSettings>

                 <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
                <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings>
<RowDropSettings></RowDropSettings>

<SearchSettings></SearchSettings>

<ScrollSettings EnableTouchScroll="False"></ScrollSettings>
            </ej:Grid>
    </div>
        <asp:SqlDataSource ID="GridSource" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" SelectCommand="sp_EmployeeDetailSelect" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <asp:SqlDataSource ID="DepartmentDropDownSource" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" 
SelectCommand="SELECT D.DepartmentID
,D.Description AS 'DepartmentDescription'
FROM Department D
WHERE D.InActiveFlag = 0
ORDER BY DepartmentDescription"></asp:SqlDataSource>
        <asp:SqlDataSource ID="EmployeeTypeDropDownSource" runat="server" ConnectionString="<%$ ConnectionStrings:HelpDeskConnectionString %>" 
SelectCommand="SELECT ET.EmployeeTypeID 
,ET.Description'EmployeeType'
FROM dbo.EmployeeType ET
WHERE ET.InActiveFlag = 0
ORDER BY ET.Description"></asp:SqlDataSource>
            <script type="text/javascript">
            function create() {
                return $("<input>");
            }

            function write(args) {
                args.element.ejDropDownList({ width: "100%", dataSource: args.column[5].dataSource, fields: { text: "DepartmentDescription", value: "DepartmentDescription" }, selectedItemIndex:0 });
            }

            function read(args) {
                return args.ejDropDownList("getSelectedValue");
            }
    </script>
</asp:Content>








MR MrT October 5, 2016 08:06 AM UTC

If possible can you try and provide the code behind in vb. and not cs. 

Please.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team October 6, 2016 08:49 AM UTC

Hi SmurofNeves, 

As per your request, we have prepared a sample in the VB that can be downloaded from the following location. Moreover, in your code example we couldn’t see any Code Behind snippets which converting the DataTable to the List using Linq. If you provide the details requested in our previous update, it will helpful to analyze the issue and provide solution as early as possible. 


    <ej:Grid ID="OrdersGrid" runat="server" DataSourceID="OrderData" AllowPaging="true"> 
        <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel,save"> 
        </ToolbarSettings> 
        <EditSettings AllowAdding="True" AllowDeleting="True" AllowEditing="True" /> 
        <Columns> 
             .. . .  
                . .  
            <ej:Column Field="EmployeeID" ForeignKeyField="EmployeeID" ForeignKeyValue="FirstName"> 
            </ej:Column> 
        </Columns> 
    </ej:Grid> 
    <asp:SqlDataSource 
        ID="dropData" 
        runat="server" 
        ConnectionString="<%$ ConnectionStrings:SQLConnectionString%>" 
        SelectCommand="SELECT * FROM Employees"></asp:SqlDataSource> 
 
    <asp:SqlDataSource 
        ID="OrderData" 
        runat="server" 
        ConnectionString="<%$ ConnectionStrings:SQLConnectionString%>" 
        SelectCommand="SELECT * FROM Orders"></asp:SqlDataSource> 

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load 
        Dim dv As DataView = DirectCast(Me.dropData.[Select](DataSourceSelectArguments.Empty), DataView) 
        Dim dt As DataTable = dv.ToTable() 
 
        Dim result = (From rw In dt.AsEnumerable() 
                      Select New With { _ 
            Key .EmployeeID = Convert.ToInt32(rw("EmployeeID")), _ 
            Key .FirstName = Convert.ToString(rw("FirstName")) _ 
        }).ToList() 
        Me.OrdersGrid.Columns(2).DataSource = result 
        'EmployeeID Column ==> Column Index = 2 
    End Sub 

Regards, 
Seeni Sakthi Kumar S. 


Loader.
Up arrow icon