Asp.net RadGrid RadComboBox客户端弹出式帮助
请帮我弄清楚这个。我想向我的RadGrid添加一个在行单击事件处理程序,以在RadGrid Editform模式下处理RadComboBox中的选择。我想做的是,当用户从组合框中进行选择时,显示一个RadWindow,允许用户在RadGrid Editform的文本框中显示其他选择。到目前为止,我所拥有的什么都没有显示,甚至没有AlertBoxAsp.net RadGrid RadComboBox客户端弹出式帮助,asp.net,ajax,telerik,radgrid,radcombobox,Asp.net,Ajax,Telerik,Radgrid,Radcombobox,请帮我弄清楚这个。我想向我的RadGrid添加一个在行单击事件处理程序,以在RadGrid Editform模式下处理RadComboBox中的选择。我想做的是,当用户从组合框中进行选择时,显示一个RadWindow,允许用户在RadGrid Editform的文本框中显示其他选择。到目前为止,我所拥有的什么都没有显示,甚至没有AlertBox function RowCreated(rowObject) { alert("Row with Index: " + rowObje
function RowCreated(rowObject) {
alert("Row with Index: " + rowObject.Index + " was created");
}
function RowSelected(sender, args) {
alert("row selected");
inputFieldValue = args.getDataKeyValue("Type");
alert(inputFieldValue);
}
function RowClick(rowIndex, e) {
alert("row Clicked");
var sourceElement;
alert(rowIndex);
}
网格的附件发生在clientevents标记中
<telerik:RadGrid ID="securityGrid" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="false" Height="99.9%" AllowCustomPaging="true">
<MasterTableView ShowFooter="true" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" EnableViewState="true" ClientDataKeyNames="HKey" DataKeyNames="HKey">
<NoRecordsTemplate>
<div align="center" style="font-weight: bold; font-size: 16px; color: Green; width: 100%;">
There Are No Records To Display. Please Select Another View.</div>
</NoRecordsTemplate>
<Columns>
<telerik:GridBoundColumn UniqueName="EHKey" Visible="false" DataField="EHKey" />
<telerik:GridCheckBoxColumn UniqueName="Active" HeaderText="Active" DataField="Active"
ColumnEditorID="ReportEditor">
<ItemStyle Width="70" />
<HeaderStyle Width="70" />
</telerik:GridCheckBoxColumn>
<telerik:GridDropDownColumn UniqueName="UILocation" DataSourceID="UILocation_DS"
HeaderText="UI Location" DataField="UILocation" ListTextField="Description" ListValueField="PrimaryKey"
DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor">
<ItemStyle Width="20%" Height="18" />
<HeaderStyle Width="20%" />
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn UniqueName="Type" DataSourceID="SecurityType_DS" HeaderText="Type"
DataField="SecurityType" ListTextField="Description" ListValueField="PrimaryKey"
DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor">
<ItemStyle Width="120" Height="18" />
<HeaderStyle Width="120" />
</telerik:GridDropDownColumn>
<telerik:GridBoundColumn UniqueName="Item" HeaderText="Item" DataField="ItemList"
ColumnEditorID="ReportEditor">
<ItemStyle Width="10%" />
<HeaderStyle Width="10%" />
</telerik:GridBoundColumn>
<telerik:GridDropDownColumn UniqueName="Access" DataSourceID="AccessType_DS" HeaderText="Access"
DataField="AccessType" ListTextField="Description" ListValueField="PrimaryKey"
DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor">
<ItemStyle Width="120" />
<HeaderStyle Width="120" />
</telerik:GridDropDownColumn>
<%-- <telerik:GridBoundColumn UniqueName="ItemList" Visible="false" DataField="ItemList" />--%>
<telerik:GridEditCommandColumn HeaderText="Edit" ButtonType="ImageButton" UniqueName="EditCommandColumn">
<ItemStyle Width="40" CssClass="WATSImageButton" />
<HeaderStyle Width="40" />
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn UniqueName="DeleteCommandColumn" ButtonType="ImageButton"
CommandName="Delete" HeaderText="Del" ConfirmTitle="Delete Strategy Milestone!"
ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow"
ConfirmDialogHeight="100" ConfirmDialogWidth="350">
<ItemStyle Width="35" CssClass="WATSImageButton" />
<HeaderStyle Width="35" />
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" Width="100%"
CssClass="masterTable" />
<FormTableStyle CellSpacing="0" CellPadding="0" Width="50%" />
<FormStyle Width="100%" BackColor="#ffffe1"></FormStyle>
<EditColumn ButtonType="ImageButton" CancelText="Cancel" UpdateText="Update" InsertText="Add" />
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<ClientEvents OnRowClick="RowClick" OnGridCreated="GridCreated" />
<Selecting AllowRowSelect="false" />
<ClientEvents />
</ClientSettings>
</telerik:RadGrid>
没有可显示的记录。请选择其他视图。
调试js代码,查看它的哪个部分得到处理,以及是否出现错误。这有助于您追踪问题所在。请看下面一行:
alert("Click on row instance: " + eventArgs.get_itemIndexHierarchical());
您尚未定义eventArgs。这是函数的第一行,因此当您单击该行时“什么也不发生”是有意义的
将您的功能更改为如下所示:
function RowClick(rowIndex, eventArgs) {
alert("Click on row instance: " + eventArgs.get_itemIndexHierarchical());
var e = window.event;
var sourceElement;
alert(sourceElement);
if (e.srcElement) {
sourceElement = e.srcElement;
alert("sourceElement");
}
else if (e.target) {
sourceElement = e.target;
alert("target");
}
alert("About to check ROw Index");
if (rowIndex != null) {
alert("Checked ROw Index");
inputField = grid.MasterTableView.Rows[rowIndex].Control.getElementsByTagName("INPUT")[0];
alert(inputField);
selvalue = sourceElement.value;
alert(selvalue);
if (inputField != null) {
alert("About to show it");
var popuppage = "userroleselect.aspx" + "?sel=" + selvalue + "&avail=" + inputField.value;
alert("Shown it!");
window.radopen(popuppage, "UserRoleDialog");
}
else {
alert("Did Not Make it");
}
}
}
请注意eventArgs参数还请注意变量e现在已在函数中定义 如何附加RowClick事件?通过在代码中添加警报进行调试并没有产生太多的效果,因为它似乎偶尔运行,并且没有达到预期效果。很抱歉,这是我的错误。尽管没有显示任何警报锅炉,但问题似乎出在行inputField=grid.MasterTableView.Rows[rowIndex].Control.getElementsByTagName(“输入”)[0];第一个问题是您的警报框应该出现。我会开始注释掉不必要的代码,直到出现警告框。一旦它们出现,我会一次添加一行代码,然后在添加每行代码后进行测试,直到确定问题的确切位置。我清除了所有代码,仍然无法获得popupI。我使用来自的示例代码进行了快速测试,效果非常好。我需要查看您的“简单”行单击函数,以查看发生了什么。连接GridView的onrowclick事件很简单,您应该能够毫无问题地获得警报。@Allison,以上就是我现在所拥有的