BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
public partial class Default : System.Web.UI.Page { List<Customer> customers = new List<Customer>(); List<Orders> order = new List<Orders>(); protected void Page_Load(object sender, EventArgs e) { for (int i = 1; i < 10; i++) { customers.Add(new Customer() { text = "Andreas", value = " Andreas " }); customers.Add(new Customer() { text = "Frank", value = " Frank " }); customers.Add(new Customer() { text = "Willi", value = " Willi " }); customers.Add(new Customer() { text = "Horst", value = " Horst " }); customers.Add(new Customer() { text = "Manfred", value = " Manfred " }); } BindDataSource(); }
private void BindDataSource() { int code = 10000; for (int i = 1; i < 10; i++) { order.Add(new Orders(code + 1, "Andreas", i + 0, 2.3 * i, new DateTime(1991, 05, 15), "Berlin")); order.Add(new Orders(code + 2, "Frank", i + 2, 3.3 * i, new DateTime(1990, 04, 04), "Madrid")); order.Add(new Orders(code + 3, "Willi", i + 1, 4.3 * i, new DateTime(1957, 11, 30), "Cholchester")); order.Add(new Orders(code + 4, "Horst", i + 3, 5.3 * i, new DateTime(1930, 10, 22), "Marseille")); order.Add(new Orders(code + 5, "Manfred", i + 4, 6.3 * i, new DateTime(1953, 02, 18), "Tsawassen")); code += 5; } this.Grid.DataSource = order; var index = this.Grid.Columns.FindIndex(col => col.Field == "CustomerID"); this.Grid.Columns.ElementAt(index).DataSource = customers; this.Grid.DataBind(); }
[Serializable]
public class Customer { public Customer() {
}
public Customer (string text, string value) { this.text = text; this.value = value; } public string text { get; set; } public string value { get; set; } } |
Hi
I click on grid for edit records - the customers dropdown is shown with the customers list but after selecting any customer and click on save then the value of selected customer is shown in grid instead of text.
public partial class Default : System.Web.UI.Page
{
List<Customer> customers = new List<Customer>();
List<Orders> order = new List<Orders>();
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 1; i < 10; i++)
{
customers.Add(new Customer() { text = "Andreas", value = "0001"});
customers.Add(new Customer() { text = "Frank", value = " 0002" });
customers.Add(new Customer() { text = "Willi", value = " 0003 " });
customers.Add(new Customer() { text = "Horst", value = " 0004 " });
customers.Add(new Customer() { text = "Manfred", value = " 0005 "});
}
BindDataSource();
}
private void BindDataSource()
{
int code = 10000;
for (int i = 1; i < 10; i++)
{
order.Add(new Orders(code + 1, "Andreas", i + 0, 2.3 * i, newDateTime(1991, 05, 15), "Berlin"));
order.Add(new Orders(code + 2, "Frank", i + 2, 3.3 * i, newDateTime(1990, 04, 04), "Madrid"));
order.Add(new Orders(code + 3, "Willi", i + 1, 4.3 * i, newDateTime(1957, 11, 30), "Cholchester"));
order.Add(new Orders(code + 4, "Horst", i + 3, 5.3 * i, newDateTime(1930, 10, 22), "Marseille"));
order.Add(new Orders(code + 5, "Manfred", i + 4, 6.3 * i, newDateTime(1953, 02, 18), "Tsawassen"));
code += 5;
}
this.Grid.DataSource = order;
var index = this.Grid.Columns.FindIndex(col => col.Field == "CustomerID");
this.Grid.Columns.ElementAt(index).DataSource = customers;
this.Grid.DataBind();
}
[Serializable]
public class Customer
{
public Customer()
{
}
public Customer (string text, string value)
{
this.text = text;
this.value = value;
}
public string text { get; set; }
public string value { get; set; }
}
}
Pratheep
<ej:Grid ID="Grid" runat="server" AllowSorting="True" AllowPaging="True"> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> <ClientSideEvents EndEdit="endedit" /> <Columns> <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="90"> <ValidationRule> <ej:KeyValue Key="required" Value="true" /> <ej:KeyValue Key="number" Value="true" /> </ValidationRule> </ej:Column> <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80"> <ValidationRule> <ej:KeyValue Key="required" Value="true" /> <ej:KeyValue Key="minlength" Value="3" /> </ValidationRule> </ej:Column> <ej:Column Field="EmployeeID" HeaderText="Employee Name" ForeignKeyField="EmployeeID" ForeignKeyValue="FirstName" TextAlign="Left" Width="90" /> <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="75" Format="{0:C}" EditType="Numeric"> <NumericEditOptions DecimalPlaces="2"></NumericEditOptions> </ej:Column> <ej:Column Field="ShipCity" HeaderText="Ship City" Width="80" /> <ej:Column Field="ShipCountry" HeaderText="Ship Country" Width="80" /> </Columns> { employee.Add(new Employee(1, "Michael")); employee.Add(new Employee(2, "Anne")); employee.Add(new Employee(3, "Janet")); employee.Add(new Employee(4, "Andrew")); employee.Add(new Employee(5, "Margaret")); employee.Add(new Employee(6, "Nancy")); employee.Add(new Employee(7, "Robert")); employee.Add(new Employee(8, "Laura")); employee.Add(new Employee(9, "Steven")); employee.Add(new Employee(10, "James")); employee.Add(new Employee(11, "Smith")); employee.Add(new Employee(12, "Jhonson")); employee.Add(new Employee(13, "George")); } public class Employee { public Employee() {
} public Employee(int EmployeeId, string FirstName) { this.EmployeeID = EmployeeId; this.FirstName = FirstName; } public int EmployeeID { get; set; } public string FirstName { get; set; } } |