teleriks rad grid를 사용하여 삽입을 수행하려고합니다. 현재 위치에서 삽입을 수행하고 onInsertCommand 메서드를 사용하여 삽입 할 값을 설정합니다. 나는 telerik의 문서에서이 진술을 발견했다 :Telerik RadGrid를 삽입 할 수 없습니다. OnInsertCommand e.item을 사용하여 현재 위치 삽입
GridEditableItem editedItem = e.Item as GridEditableItem; 내가 그것을 editedItem가 null 값을 얻고있다 사용할 때 내가 그것을 작동하게하는 방법을 잘 모릅니다 : 여기
가에 InsertCommand 위한 뒤에 내 코드입니다보호 무효 RadGrid1_InsertCommand (개체 보낸 사람, Telerik.Web.UI.GridCommandEventArgs 전자) {
GridEditableItem editedItem = e.Item as GridEditableItem;
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
editedItem.Edit = false;
Yieldco.RS.Libraries.BusinessObjects.UnitType u1 = new Yieldco.RS.Libraries.BusinessObjects.UnitType();
u1.Description = newValues["Description"].ToString();
u1.UnitTypeID = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["UnitTypeID"]);
u1.CommunityID = 1;
u1.CompanyID = 1;
u1.Bathrooms = (float)Convert.ToDouble(newValues["Bathrooms"]);
u1.Bedrooms = Convert.ToInt32(newValues["Bedrooms"]);
u1.SqFtHigh = (float)Convert.ToDouble(newValues["SqFtHigh"]);
u1.SqFtLow = (float)Convert.ToDouble(newValues["SqFtLow"]);
u1.NumOfUnits = Convert.ToInt32(newValues["NumOfUnits"]);
u1.ProCon = Convert.ToInt32(newValues["ProCon"]);
u1.OthCon = Convert.ToInt32(newValues["OthCon"]);
u1.RentHigh = (float)Convert.ToDouble(newValues["RentHigh"]);
u1.RentLow = (float)Convert.ToDouble(newValues["RentLow"]);
u1.Status = 1;
int id = MSController.SaveUnitTypes(u1);
}
내 영문은 = "false"를 AllowAutomaticUpdates = "F
AutoGenerateColumns
EditItemStyle 폭 ="24 픽셀 "> <퍼센트 -
- % > "AddAd"Text = "Cancel"CommandName = "CancelAll"=> "CommandName ="InitInsert "/>'runat ="server "ID ="CancelAdd " /> 'RUNAT = "서버"ID = "InsertNew"텍스트 = "수행 삽입"명령 이름 = "PerformInsert"/>
'RUNAT = "서버"ID = "EditAll"텍스트 = "모두 편집" "run"= "EditAll"/> 0 %> 'runat = "server"ID = "CancelAdit"CommandName = "CancelAll"/> "Text ="모두 업데이트 "CommandName ="UpdateAll "OnClientClick = 'javascript : return confirm ("Are you su 당신은 모든 레코드를 업데이트 할 재? ") '/>
<asp:ObjectDataSource ID="odsGetUnitTypes" runat="server"
TypeName="Yieldco.RS.Libraries.Controllers.MSController"
DataObjectTypeName="Yieldco.RS.Libraries.BusinessObjects.UnitType"
SelectMethod="GetUnitTypesByCommunityID"
InsertMethod="SaveUnitTypes"
UpdateMethod="SaveUnitTypes"
>
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="CommunityID" />
</SelectParameters>
</asp:ObjectDataSource>
사점 삽입을 만들기 위해 저를 도와주세요.
는 또한 Telerik 문서에서 나는 그들이 vdatakeyvalue을 얻기를 위해 e.ite.item
인덱스를 사용하지만 난 그것을 인덱스를 사용하는 경우 항상로 게재됩니다 보았다 -1 그래서 editedItem.ItemIndex
를 사용하고 미리
감사를 작동