Hello Mate!,
First of all i have two webpages. one acts as a master page and other one acts as a popup page. when i click a button (say Add button) in the master page the pop up page should open. and when i click submit button in the pop up page after entering some values in the textboxes of the pop up page, a jscript function should take the values of the text boxes in the pop up page and should pass it to a webmethod which accepts these parameters.
In the webmethod i am filling a datatable with the parameters that i had received from the jscript function and storing that datatable in a session variable.
after these operation the jscript function should close the popup window and should refresh the parent window making a datagrid in the master page populated with that datatable from session .
i am using the webservice behavior to call the webmethod from jscript .
every thing works fine but when i enter some values in the pop up page and click submit button those values weren't populated in the datagrid. instead when do this operation again and click submit button the values which i had entered in the first operation gets filled in the operation.
Or only when i refresh the master page after performing the first operation the datagird gets filled with those values in the pop up page.
This is the Jscript function that passes the values in the popup page to a web method and this function will be invoked when we click submit button in the pop up page:
I have used 'opener.submit' to aviod a message box saying 'the page cannot be refreshed with out resending the information'.
function CreateAndFillTable()
{
var
strtxtCust_cp_code = document.getElementById("Table1_txtCust_cp_code").value;
var
strtxtCust_cp_name = document.getElementById("Table1_txtCust_cp_name").value;
var
strtxtCust_cp_desig = document.getElementById("Table1_txtCust_cp_desig").value;
var
strtxtcust_cp_ph_no = document.getElementById("Table1_txtCust_cp_phone_no").value;
var
strtxtCust_cp_mobile_no = document.getElementById("Table1_txtCust_cp_mobile_no").value;
var
strtxtCust_cp_email_id = document.getElementById("Table1_txtCust_cp_email").value;var strtxtCust_cp_rmks = document.getElementById("Table1_txtCust_cp_rmks").value;
service.useService("http://192.168.10.29/logistics/Masters/GridTasks.asmx?WSDL","GridTasks"); iCallID1 = service.GridTasks.callService(SucceededCallback,"FillTable",strtxtCust_cp_code,strtxtCust_cp_name,strtxtCust_cp_desig,strtxtcust_cp_ph_no,strtxtCust_cp_mobile_no,strtxtCust_cp_email_id,strtxtCust_cp_rmks);
}
function SucceededCallback()
{
//debugger;
opener.document.forms["aspnetform"].submit();
window.close();
}
This is the webmethod that fills a datatable using the parameters that had been received from the above jscript function:
<WebMethod(True)> _Public Sub FillTable(ByVal strtxtCust_cp_code As String, ByVal strtxtCust_cp_name As String, ByVal strtxtCust_cp_desig As String, ByVal strtxtcust_cp_ph_no As String, ByVal strtxtCust_cp_mobile_no As String, ByVal strtxtCust_cp_email_id As String, ByVal strtxtCust_cp_rmks As String)
Dim Table6 As New DataTable
Delete.ColumnName = Dim Delete As New DataColumn"Delete"
Dim Modify As New DataColumnModify.ColumnName = "Modify"
Dim Code As New DataColumn Code.ColumnName = "Code"
Dim Name As New DataColumn Name.ColumnName = "Name"
Dim Designation As New DataColumn Designation.ColumnName = "Designation"
Dim Phone As New DataColumn Phone.ColumnName = "Phone"
Dim Mobile As New DataColumn Mobile.ColumnName = "Mobile"
Dim Email As New DataColumn Email.ColumnName = "Email"
Dim Remarks As New DataColumnRemarks.ColumnName = "Remarks"
Table6.Columns.Add(Delete)
Table6.Columns.Add(Modify)
Table6.Columns.Add(Code)
Table6.Columns.Add(Name)
Table6.Columns.Add(Designation)
Table6.Columns.Add(Phone)
Table6.Columns.Add(Mobile)
Table6.Columns.Add(Email)
Table6.Columns.Add(Remarks)
If Session("CUST_Info") Is Nothing Then
Table6.Rows.Add(0)
Table6.Rows(0).Item(
"Delete") = "Delete.png"
Table6.Rows(0).Item(
"Modify") = "Modify.png"Table6.Rows(0).Item("Code") = strtxtCust_cp_code
Table6.Rows(0).Item(
Table6.Rows(0).Item("Name") = strtxtCust_cp_name"Designation") = strtxtCust_cp_desig
Table6.Rows(0).Item(
Table6.Rows(0).Item("Phone") = strtxtcust_cp_ph_no"Mobile") = strtxtCust_cp_mobile_no
Table6.Rows(0).Item(
Table6.Rows(0).Item("Email") = strtxtCust_cp_email_id"Remarks") = strtxtCust_cp_rmks
ElseTable6 = Session("CUST_Info")
Dim i As Integer
i = Table6.Rows.Count
Table6.Rows.Add(i)
Table6.Rows(i).Item(
"Delete") = "Delete.png"
Table6.Rows(i).Item(
"Modify") = "Modify.png"Table6.Rows(i).Item("CODE") = strtxtCust_cp_code
Table6.Rows(i).Item(
Table6.Rows(i).Item("Name") = strtxtCust_cp_name"Designation") = strtxtCust_cp_desig
Table6.Rows(i).Item(
Table6.Rows(i).Item("Phone") = strtxtcust_cp_ph_no"Mobile") = strtxtCust_cp_mobile_no
Table6.Rows(i).Item(
Table6.Rows(i).Item("Email") = strtxtCust_cp_email_id"Remarks") = strtxtCust_cp_rmks
End IfSession("CUST_Info") = Table6
End Sub