DataTable.AddRow(row); // add row to table
insert_Item.DataItem = row;
insert_Item.Edit =
true;
rdgrd.MasterTableView.IsItemInserted =
false;
This turns the last item in the grid into regular, non-editable item unless Refresh is pressed.
I was wondering wether there is a cleaner way of doing multiple inserts to a grid where all rows are turned into editable items. I could not find any single example exploring this scenario.
Thank you,
Chris
| <telerik:RadSlider ID="rdSlider" runat="server" OnClientValueChange="HandleValueChange" |
| OnClientLoaded="HandleValueChange" Width="135" |
| CausesValidation="false" Visible="true" TrackPosition="Center" |
| OnValueChanged="rdSlider_ValueChanged" AutoPostBack="true" ItemType="Tick" LargeChange="100"> |
| </telerik:RadSlider> |
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="webTest._Default" %>
<%
@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
<title>Untitled Page</title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="rsm" runat="server"></telerik:RadScriptManager>
<telerik:RadComboBox ID="RadComboBox1" runat="server"
Height="190px"
Width="420px"
MarkFirstMatch="true"
AllowCustomText="true"
EnableLoadOnDemand="true"
HighlightTemplatedItems="true"
DropDownWidth="423px"
ItemRequestTimeout="500" OnItemDataBound="RadComboBox1_ItemDataBound" OnItemsRequested="RadComboBox1_ItemsRequested" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
<headertemplate>
<table style="width:415px; text-align:left">
<tr>
<td style="width:125px;">
Id
</td>
<td style="width:125px;">
Name
</td>
</tr>
</table>
</headertemplate>
<ItemTemplate>
<table style="width:415px; text-align:left">
<tr>
<td style="width:125px;">
<%
# DataBinder.Eval(Container.DataItem, "Id") %>
</td>
<td style="width:125px;">
<%
# DataBinder.Eval(Container.DataItem, "Name") %>
</td>
</ItemTemplate>
</
telerik:RadComboBox>
</div>
</form>
</
body>
</
html>
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
using
Telerik.Web.Design;
using
System.Data.OleDb;
using
System.Text;
using
System.IO;
namespace
webTest
{
public partial class _Default : System.Web.UI.Page
{
OleDbConnection cn;
OleDbDataAdapter da;
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && !Page.IsCallback)
{
Load1(
string.Empty);
}
}
public void Load1(string filter)
{
string sql = "select * from emp1234";
cn =
new OleDbConnection("Provider=OraOLEDB.Oracle;Data Source=D1;User ID=SC;Password=D1;Connection Lifetime=600;Max Pool Size=100");
cn.Open();
sql +=
" where Name LIKE '" + filter.Replace("'","''") + "%'";
Response.Write(sql);
da =
new OleDbDataAdapter(sql, cn);
ds =
new DataSet();
da.Fill(ds);
cn.Close();
DataView dv = new DataView(ds.Tables[0]);
RadComboBox1.DataSource = dv;
RadComboBox1.DataBind();
}
protected void RadComboBox1_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
Load1(e.Text);
}
protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
RadComboBoxItem item = e.Item;
DataRowView drv = (DataRowView)e.Item.DataItem;
e.Item.Text = drv[
"Name"].ToString();
}
protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
}
}
}
I have a form with two RadComboBoxes. One contains a list of states and the other contains a list of counties. Basically, this is a cascading droplist scenario. The OnClientSelectedIndexChanged event on the States RadComboBox is set to ChildRadComboChange shown below. To populate the Counties RadComboBox when a state is selected, I run a LoadCounties method that is triggered by the State.ItemsRequested event. So far, so good.
The problem comes in when the ChildRadComboLoad function runs (shown below). The line childCombo.ClearItems() throws a Microsoft JScript runtime error: Object doesn't support this property or method. The childID contains a valid control id and the childCombo variable is set to the correct RadComboBox (the div, actually).
Any ideas why I can't run this function on the RadComboBox? I have also seen this with some of the other functions like RequestItems?
----Javascript functions
function ChildRadComboChange(sender, eventArgs) {
var item = eventArgs.get_item();
ChildRadComboLoad(sender, item);
}
function ChildRadComboLoad(sender, item) {
var childID = ChildRadComboArray[sender.get_id()];
var childCombo = document.getElementById(childID);
childCombo.ClearItems();
if (item.get_index() > 0) {
childCombo.RequestItems(item.get_value(),false);
childCombo.set_text('');}
else {
childCombo.disable();
childcombo.set_text(ChildRadComboArray[sender.get_id()+'_msg']);
}
}
Sincerely,
Sean M. Severson