Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
WebDataGrid and WebDialogBox doesnt seem to work together
posted

I'm working on modifying pages that were initially coded and working with the use of asp:GridView and ig:WebDialogWindow

When I switch to using ig:WebDataGrid the WebDialogWindow now doesn't show up when the WebDialogWindow.WindowState is set to Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal.

The other page I have that still has the GridView on still works.

I'm using Infragistics professional (ASP.NET 2023).

code below - NOTE i ruled out the context menu by commenting it out of the aspx page I have a separate issue with the context menu that I will post separately


<ig:WebDataMenu runat="server" ID="ContextMenu" IsContextMenu="true"
BorderStyle="Solid" BorderWidth="1" BorderColor="#CCCCCC">
<ClientEvents ItemClick="MenuItem_Click" />
<Items>
<ig:DataMenuItem Text="Edit post Information" Key="Edit" />
<ig:DataMenuItem Text="Manage post users" Key="Users" />
<ig:DataMenuItem Text="View post logs" Key="Logs" />
</Items>
</ig:WebDataMenu>

<%-- Height="350px" Width="400px" --%>
<ig:WebDataGrid ID="igPostList" runat="server"
DataKeyFields="PostName" AutoGenerateColumns="False" CellSpacing="1"
BorderWidth="1"
CssClass="gridview" AltItemCssClass="gridviewAlt"
Enabled="false" Visible="true"
OnRowSelectionChanged="igPostList_RowSelectionChanged">
<Behaviors>
<ig:Paging PagerAppearance="Both" PageSize="20" PagerMode="NextPreviousFirstLast"
FirstPageText="First" LastPageText="Last" NextPageText="Next" PreviousPageText="Prev"></ig:Paging>
<ig:Filtering Enabled="true"></ig:Filtering>
<ig:Sorting></ig:Sorting>
<ig:RowSelectors></ig:RowSelectors>
<ig:Selection RowSelectType="Single" Enabled="true"
CellClickAction="Row" CellSelectType="None">
<AutoPostBackFlags RowSelectionChanged="True" />
</ig:Selection>
</Behaviors>
<ClientEvents MouseDown="GridMouseDown" />
<Columns>
<ig:BoundDataField DataFieldName="PostName" Width="250px" Key="PostName">
<Header Text="Post Name"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Info" Width="620px" Key="PLA">
<Header Text="PLA"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Route" Width="120px" Key="Route">
<Header Text="Route"></Header>
</ig:BoundDataField>
</Columns>

</ig:WebDataGrid>


<%-- Add New Post Dialog --%>
<style>
.labelCell
{
Font-Size:larger;
font-weight:300;
Width:150px;
}
.dataCell
{
margin:0;
padding:0;
border-spacing:0;
}
</style>

<ig:WebDialogWindow ID="PostInfoDlg" runat="server"
Height="350px" Width="400px"
BorderStyle="Dotted" BorderColor="Black" BorderWidth="1px"
Modal="true" WindowState="Hidden" InitialLocation="Centered" BackColor="White" Resizer-Enabled="True">
<Header CaptionText="Post Information" BackColor="#00FFCC" Font-Bold="true" Font-Size="Medium" MaximizeBox-Visible="True" MinimizeBox-Visible="True">
<CloseBox Visible="false" />
<MinimizeBox Visible="false" />
<MinimizeBox Visible="false" />
</Header>
<Resizer Enabled="false" />
<ContentPane>
<Template>
<div>
<div style="background-color:silver">
<div class="col-md-12">
&nbsp;&nbsp;
<asp:ImageButton ID="SavePostButton" runat="server"
ImageUrl="~/Images/Save.ico" OnClick="SavePostButton_Click"
tooltip="Save Post" ValidationGroup="PostGrp" />
&nbsp;
<asp:ImageButton ID="CancelPostButton" runat="server"
ImageUrl="~/Images/cancel.ico" OnClick="CancelPostButton_Click"
tooltip="Cancel Post changes"/>
</div>
</div>
<div>
<div class="md-col-12">
&nbsp;
</div>
</div>
<div>
<div class="md-col-12">
<asp:Table ID="Table1" runat="server">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Right" CssClass="labelCell">
<asp:Label ID="Label3" runat="server" Text="Post:" Font-Size="Larger" Font-Bold="True"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="PostName" runat="server" height="30" Enabled="true"
width="350px" Font-Size="Small"></asp:TextBox>
</asp:TableCell>
<asp:TableCell>
<asp:RequiredFieldValidator ID="RequiredFieldPostName" runat="server" ValidationGroup="PostGrp"
ControlToValidate="PostName" ErrorMessage="*" Font-Bold="True" ForeColor="#CC0000"></asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Right" CssClass="labelCell">
<asp:Label ID="Label4" runat="server" Text="Address:" Font-Size="Larger" Font-Bold="True"></asp:Label>
</asp:TableCell>
<asp:TableCell>
<asp:TextBox ID="PostAddress" runat="server" height="30" Enabled="true"
width="350px" Font-Size="Small"></asp:TextBox>
</asp:TableCell>
<asp:TableCell>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="3">
<asp:Label ID="PostErrorMessage" runat="server" ForeColor="Red" Font-Bold="True"></asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</div>
</div>
</Template>
</ContentPane>
</ig:WebDialogWindow>

<script language="javascript" type="text/javascript">

var currentSelectedRow = null;
var currentSelectedPost = "";

function MenuItem_Click(menu, eventArgs) {
if (currentSelectedRow == null)
return;

switch (eventArgs.getItem().get_key()) {
case "Edit":
currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().clear();

if (currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().indexOf(currentSelectedRow) == -1)
currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().add(currentSelectedRow);
break;
case "Users":
location.href = "./PostUsers?Post=" + encodeURIComponent(currentSelectedPost);
////location.href = "./PostUsers?Post=" + encodeURIComponent(currentSelectedRow.get_cellByColumnKey('PostName').get_text());
//currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().clear();
//if (currentSelectedRow.get_grid().get_behaviors().get_selection() != null) {
// if (currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().indexOf(currentSelectedRow) == -1)
// currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().add(currentSelectedRow);
// //else
// // currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().remove(currentSelectedRow);
//}
break;
case "Logs":
location.href = "./logs?Post=" + encodeURIComponent(currentSelectedPost);
////location.href = "./logs?Post=" + encodeURIComponent(currentSelectedRow.get_cellByColumnKey('PostName').get_text());
//currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().clear();
//if (currentSelectedRow.get_grid().get_behaviors().get_selection() != null) {
// if (currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().indexOf(currentSelectedRow) == -1)
// currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().add(currentSelectedRow);
// //else
// // currentSelectedRow.get_grid().get_behaviors().get_selection().get_selectedRows().remove(currentSelectedRow);
//}
break;
}
}

function GridMouseDown(grid, eventArgs) {

if (eventArgs.get_item() == null || !eventArgs.get_item().get_row) {
return;
}

currentSelectedRow = eventArgs.get_item().get_row();

var postname = currentSelectedRow.get_cellByColumnKey('PostName').get_text();

var menu = $find("<%= this.ContextMenu.ClientID %>");

//menu.getItems().getItem(0).set_text('Edit ' + postname + ' info');
//menu.getItems().getItem(1).set_text('Manage ' + postname + ' users');
//menu.getItems().getItem(2).set_text('View ' + postname + ' logs');

currentSelectedPost = postname;

if (menu != null && eventArgs.get_browserEvent() != null && eventArgs.get_browserEvent().button == 2) {
menu.showAt(null, null, eventArgs.get_browserEvent());
}
}
</script>


-------------------------- .CS code

protected void igPostList_RowSelectionChanged(object sender, SelectedRowEventArgs e)
{
WebDataGrid myGrid = (WebDataGrid)sender;
string selPostname = "";

if (myGrid == null || e.CurrentSelectedRows.Count < 1)
{
return;
}

selPostname = e.CurrentSelectedRows[0].DataKey[0].ToString();

PostInfoDlg.Header.CaptionText = selPostname + " Information";
PostInfoDlg.Enabled = true;
//
// add code to fill in other dialog fields
//
PostInfoDlg.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal;
}

Parents
No Data
Reply
  • 1700
    Offline posted

    Hello Erik

    The reason why the WebDialogWidnow is not showing is that even though you are performing an asynchronous postback for the WebDataGrid, this asynchronous postback does not affect the WebDialogWidnow.

    In order to show the dialog when the user selects a row, you would need to place the WebDialogWidnow, WebDataGrid and the WebDataMenu inside an UpdatePanel. Please note that it is recommended to set the following properties to False – EnableAjax and EnableAjaxViewState ,when using UpdatePanel, in order to ensure that the interaction between the grid and the UpdatePanel would not create any issues.

    I am attaching a small sample that demonstrates the solution.

    Please test the sample on your side and let me know if you have any questions.

    Regards,
    Ivan Kitanov

    WebDataMenuChangeTextOnRowSelect.zip

Children
No Data