I have a button outside my radgrid which when clicks, calls clientside javascript to open a modal radwindow and the window executes a wizard to create users for my grid. When the radwindow closes, I want the grid to rebind to show the new users. I have the window being created in the onclientclick event of the button. I also have an onclick server event handler for the button to rebind the grid, but it never gets executed. How can I rebind the grid after the window closes? I am attaching some code - hope it's enough....
aspx and Javascript:
<div style="height:40px;width:50px;">
<asp:Button runat="server" id="WizardButton" style="width:170px;" OnClientClick="openWin('<%# TextBoxOrderDetailID.Text %>'); return false;" OnClick="rebindUsers" Text="Create Users"> </asp:Button>
</div>
<telerik:RadWindowManager ID="wizardWindowManager"
Behaviors=" Move, resize, close" Modal="true" ReloadOnShow = "true" BackColor="AliceBlue" ForeColor ="AntiqueWhite" KeepInScreenBounds="true" runat="server" Skin="Office2007" VisibleStatusbar="false" BorderColor="AliceBlue" >
</telerik:RadWindowManager>
.....
<telerik:RadGrid ID="usersGrid" runat="server"
DataSourceID="ContentCentralUsers" GridLines="None" Skin="Office2007" AutoGenerateColumns="False"
ondatabound="usersGrid_DataBound" onitemdatabound="usersGrid_ItemDataBound" OnItemCreated="usersGrid_ItemCreated"
onitemevent="usersGrid_ItemDataBound" oniteminserted="usersGrid_ItemInserted" onitemupdated="usersGrid_ItemUpdated"
ShowStatusBar="True" OnPreRender="usersGrid_PreRender" oninsertcommand="usersGrid_InsertCommand" OnItemCommand="usersGrid_ItemCommand"
onupdatecommand="usersGrid_UpdateCommand" >
<MasterTableView DataSourceID="ContentCentralUsers" DataKeyNames="user_id,package_cd"
AllowFilteringByColumn="True" AllowSorting="True"
InsertItemPageIndexAction="ShowItemOnFirstPage" CommandItemDisplay="Top"
NoMasterRecordsText="No users to display.">
<CommandItemSettings AddNewRecordText="Add new user" />
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
<HeaderStyle Width="20px" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="user_id" UniqueName="user_id" Visible="false" ReadOnly="true" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="package_cd" UniqueName="package_cd" Visible="false" ReadOnly="true" ></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Seat(User)" SortExpression="login_name" UniqueName="login_name" >
<ItemTemplate>
<asp:Label ID="login_name" runat="server" Text='<%#Eval("login_name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="loginname" Text='<%#Eval("login_name") %>' runat="server" OnTextChanged="change_loginName"></asp:TextBox>
<asp:RequiredFieldValidator id="loginnameRequiredFieldValidator" runat="server" ErrorMessage="* User name required" Display="Dynamic"
ControlToValidate= "loginname"></asp:RequiredFieldValidator>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Password" SortExpression="password" UniqueName="password" EditFormColumnIndex="1" AllowFiltering="false">
<ItemTemplate>
<asp:Label ID="password" runat="server" Text='<%#Eval("password") %>'></asp:Label></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="editPassword" Text='<%#Eval("password") %>' runat="server" OnTextChanged="change_Password" ></asp:TextBox><asp:RequiredFieldValidator id="passwordRequiredFieldValidator" runat="server" ErrorMessage="* Password required" Display="Dynamic"
ControlToValidate= "editPassword"></asp:RequiredFieldValidator>
</EditItemTemplate>
</telerik:GridTemplateColumn><telerik:GridTemplateColumn HeaderText="Email" SortExpression="email" UniqueName="email" >
<ItemTemplate>
<asp:Label ID="email" runat="server" Text='<%#Eval("email") %>'></asp:Label></ItemTemplate><EditItemTemplate>
<asp:TextBox ID="editEmail" Text='<%#Eval("email") %>' runat="server" OnTextChanged="change_email"></asp:TextBox><asp:RequiredFieldValidator id="emailValidator1" runat="server" ErrorMessage="* Email required" Display="Dynamic"
ControlToValidate= "editEmail"></asp:RequiredFieldValidator><asp:RegularExpressionValidator Runat="server" ErrorMessage="* Invalid E-mail Address" ID="emailValidator2" Display="Dynamic"
ControlToValidate="editEmail" ValidationExpression=".+@.+\.[a-z]+"></asp:RegularExpressionValidator></EditItemTemplate></telerik:GridTemplateColumn><telerik:GridTemplateColumn HeaderText="Package" UniqueName="DefaultPackage" EditFormColumnIndex="1" >
<HeaderStyle Width="100%" />
<ItemTemplate>
<asp:Label runat="server" ID="Label1" Text='<%#..........
Javascript:
function openWin(OrderDetailID) {
var urlArgs = cbeGetURLArguments();
var sbOID = parseInt(urlArgs['sbOID']);
var queryODID = parseInt(urlArgs['sbODID']);
var sbproductid = parseInt(urlArgs['sbproductid']);
var SAPID = urlArgs['SAPID'];
var txtbxODID = document.getElementById('TextBoxOrderDetailID').value;
var txtbxProduct = document.getElementById('TextBoxProduct').value;
var licensePrice = document.getElementById('licensePrice').value;
if (txtbxODID == null)
sbODID = queryODID;
else
sbODID = txtbxODID;
var windowURL = "v8Wizard_1.aspx?sbODID=" + sbODID + "&sbproductid=" + sbproductid + "&SAPID=" + SAPID +
"&lPrice=" + licensePrice + "&email=" + "" + "&ttt=" + "" + "&p_cd=" + "NTB" + "&sbOID=" + sbOID + "&numUsers=&packagePrice=0";
var oWnd = radopen(windowURL, "RadWindow1");
oWnd.setSize(650, 500);
// oWnd.setSize(650, 600);
oWnd.center();
//set a function to be called when RadWindow is closed
oWnd.add_close(OnClientClose);
}
function OnClientClose(oWnd) {
}
C#: but this is never getting executed
protected void rebindUsers(Object sender, EventArgs e)
{
TextBoxOrderDetailID.Text = Session["orderDetailID"].ToString();
CompanyInfoGrid.MasterTableView.Rebind();
usersGrid.MasterTableView.Rebind();
}
aspx and Javascript:
<div style="height:40px;width:50px;">
<asp:Button runat="server" id="WizardButton" style="width:170px;" OnClientClick="openWin('<%# TextBoxOrderDetailID.Text %>'); return false;" OnClick="rebindUsers" Text="Create Users"> </asp:Button>
</div>
<telerik:RadWindowManager ID="wizardWindowManager"
Behaviors=" Move, resize, close" Modal="true" ReloadOnShow = "true" BackColor="AliceBlue" ForeColor ="AntiqueWhite" KeepInScreenBounds="true" runat="server" Skin="Office2007" VisibleStatusbar="false" BorderColor="AliceBlue" >
</telerik:RadWindowManager>
.....
<telerik:RadGrid ID="usersGrid" runat="server"
DataSourceID="ContentCentralUsers" GridLines="None" Skin="Office2007" AutoGenerateColumns="False"
ondatabound="usersGrid_DataBound" onitemdatabound="usersGrid_ItemDataBound" OnItemCreated="usersGrid_ItemCreated"
onitemevent="usersGrid_ItemDataBound" oniteminserted="usersGrid_ItemInserted" onitemupdated="usersGrid_ItemUpdated"
ShowStatusBar="True" OnPreRender="usersGrid_PreRender" oninsertcommand="usersGrid_InsertCommand" OnItemCommand="usersGrid_ItemCommand"
onupdatecommand="usersGrid_UpdateCommand" >
<MasterTableView DataSourceID="ContentCentralUsers" DataKeyNames="user_id,package_cd"
AllowFilteringByColumn="True" AllowSorting="True"
InsertItemPageIndexAction="ShowItemOnFirstPage" CommandItemDisplay="Top"
NoMasterRecordsText="No users to display.">
<CommandItemSettings AddNewRecordText="Add new user" />
<Columns>
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
<HeaderStyle Width="20px" />
</telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="user_id" UniqueName="user_id" Visible="false" ReadOnly="true" ></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="package_cd" UniqueName="package_cd" Visible="false" ReadOnly="true" ></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Seat(User)" SortExpression="login_name" UniqueName="login_name" >
<ItemTemplate>
<asp:Label ID="login_name" runat="server" Text='<%#Eval("login_name") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="loginname" Text='<%#Eval("login_name") %>' runat="server" OnTextChanged="change_loginName"></asp:TextBox>
<asp:RequiredFieldValidator id="loginnameRequiredFieldValidator" runat="server" ErrorMessage="* User name required" Display="Dynamic"
ControlToValidate= "loginname"></asp:RequiredFieldValidator>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Password" SortExpression="password" UniqueName="password" EditFormColumnIndex="1" AllowFiltering="false">
<ItemTemplate>
<asp:Label ID="password" runat="server" Text='<%#Eval("password") %>'></asp:Label></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="editPassword" Text='<%#Eval("password") %>' runat="server" OnTextChanged="change_Password" ></asp:TextBox><asp:RequiredFieldValidator id="passwordRequiredFieldValidator" runat="server" ErrorMessage="* Password required" Display="Dynamic"
ControlToValidate= "editPassword"></asp:RequiredFieldValidator>
</EditItemTemplate>
</telerik:GridTemplateColumn><telerik:GridTemplateColumn HeaderText="Email" SortExpression="email" UniqueName="email" >
<ItemTemplate>
<asp:Label ID="email" runat="server" Text='<%#Eval("email") %>'></asp:Label></ItemTemplate><EditItemTemplate>
<asp:TextBox ID="editEmail" Text='<%#Eval("email") %>' runat="server" OnTextChanged="change_email"></asp:TextBox><asp:RequiredFieldValidator id="emailValidator1" runat="server" ErrorMessage="* Email required" Display="Dynamic"
ControlToValidate= "editEmail"></asp:RequiredFieldValidator><asp:RegularExpressionValidator Runat="server" ErrorMessage="* Invalid E-mail Address" ID="emailValidator2" Display="Dynamic"
ControlToValidate="editEmail" ValidationExpression=".+@.+\.[a-z]+"></asp:RegularExpressionValidator></EditItemTemplate></telerik:GridTemplateColumn><telerik:GridTemplateColumn HeaderText="Package" UniqueName="DefaultPackage" EditFormColumnIndex="1" >
<HeaderStyle Width="100%" />
<ItemTemplate>
<asp:Label runat="server" ID="Label1" Text='<%#..........
Javascript:
function openWin(OrderDetailID) {
var urlArgs = cbeGetURLArguments();
var sbOID = parseInt(urlArgs['sbOID']);
var queryODID = parseInt(urlArgs['sbODID']);
var sbproductid = parseInt(urlArgs['sbproductid']);
var SAPID = urlArgs['SAPID'];
var txtbxODID = document.getElementById('TextBoxOrderDetailID').value;
var txtbxProduct = document.getElementById('TextBoxProduct').value;
var licensePrice = document.getElementById('licensePrice').value;
if (txtbxODID == null)
sbODID = queryODID;
else
sbODID = txtbxODID;
var windowURL = "v8Wizard_1.aspx?sbODID=" + sbODID + "&sbproductid=" + sbproductid + "&SAPID=" + SAPID +
"&lPrice=" + licensePrice + "&email=" + "" + "&ttt=" + "" + "&p_cd=" + "NTB" + "&sbOID=" + sbOID + "&numUsers=&packagePrice=0";
var oWnd = radopen(windowURL, "RadWindow1");
oWnd.setSize(650, 500);
// oWnd.setSize(650, 600);
oWnd.center();
//set a function to be called when RadWindow is closed
oWnd.add_close(OnClientClose);
}
function OnClientClose(oWnd) {
}
C#: but this is never getting executed
protected void rebindUsers(Object sender, EventArgs e)
{
TextBoxOrderDetailID.Text = Session["orderDetailID"].ToString();
CompanyInfoGrid.MasterTableView.Rebind();
usersGrid.MasterTableView.Rebind();
}