|
I've got main page, Page1.
The Page2 is opened with javascript window.open() attributed in some Page1 button control.
So I need to refresh Page1 from Page2
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: I've got main page, Page1.
The Page2 is opened with javascript window.open() attributed in some Page1 button control.
So I need to refresh Page1 from Page2
Ohhh... Man... Did you mention it earlier... that your Page 2 is popup
Or May be I missed it out.
use,
window.opener.RefereshPresentPage();
|
|
|
|
|
Yes, sorry, Page2 is a popup opened with window.open();
How should I call window.opener.RefreshPresentPage()?
There is a button click handler, where should I paste it?
Чесноков
|
|
|
|
|
|
- On Second page if changes done then set any flag in session.
- On First page poll the flag session periodically via javascript, if flag session set then submit the page throught javascript and perform operation accordingly.
|
|
|
|
|
but that will take some additional java script over head?
Чесноков
|
|
|
|
|
Yes you are right. I think it is a better.
|
|
|
|
|
Oh.. Is the second page is opening in a new window.
If so, just place a Javascript in the response.
this.ClientScript.RegisterStartupScript(typeof(Page), "myscript", "<script>window.opener.document.form[0].submit();</script>");
Or just
this.ClientScript.RegisterStartupScript(typeof(Page), "myscript", "<script>window.opener.location.href = "page.aspx";</script>");
Where page.aspx is the location of the other page.
Hope it works. I didnt tried it.
|
|
|
|
|
Yes, it is in the new window.
How can I attach that to some web control e.g. button?
I need to click a button in the Page2 and Page1 will refresh.
Чесноков
|
|
|
|
|
Simple..
write the RegisterScript code inside the Button_click event, if you need it from the server.
Or just write window.opener.location.href = 'yourpage.aspx'; return false;
in onClientClick event.
return false will eliminate postback if you want.
|
|
|
|
|
How can I put it into the button click code?
buttonClick()
{
} ;
Чесноков
|
|
|
|
|
Try this :
btn.Attributes.Add("onclick", "javascript:window.opener.location.href='page1.aspx'; return false;");
write this in page_load of Page2.aspx .
So that when btn is clicked it will refresh the page1.aspx
Hope it works now.
|
|
|
|
|
hi all,
I want to download the file from db which has been save in my application.I downloaded the file . but i want to open it as a pdf file.How to do that..
Here is the code i used to download.
if (e.CommandName == "ResumeDownload")
{
Cache["filename"] = e.CommandArgument.ToString();
String strRequest = Cache["filename"].ToString();
if (strRequest != "")
{
String path = Server.MapPath("Attachments\\" + strRequest);
FileInfo file = new FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + file.Name.ToString()+ "\"");
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
else
ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script>alert('File Not Found')</script>");
}
else
Response.Write("Please provide a file to download.");
}
|
|
|
|
|
Try changing the ContentType to application/pdf. I haven't tried this so there is every chance it won't work but you never know.
|
|
|
|
|
|
DoctorMick wrote: application/pdf
this wont work.. This will open a pdf but without any content.....
|
|
|
|
|
Hi everyone, I am trying to write a web method in my web service which will accept information in a hashtable and process it and again will return hashtable. I am trying to do this in C#. But it is throwing an exception that hashtable can't be serialized b'coz it implements IDictionary. Is there any solution.....
|
|
|
|
|
Yes it's write, Only serializable object can return the web method. So Implement this information in dataset and the finally return Dataset.
OR look into this Article
Hashtable becomes serialized[^]
|
|
|
|
|
Hello every one,
I want to create a stored procedure,which takes different parameters and insert the value in same table.
What should i do,how can i write this.
|
|
|
|
|
rinku soni 23 wrote: I want to create a stored procedure
wrong post...
rinku soni 23 wrote: What should i do,how can i write this
public static void insert(paramater1,paramater2,......,SqlConnection con )
{
try
{
SqlParameter[] param = new SqlParameter[6];
param[0] = new SqlParameter("@...", SqlDbType.VarChar);
param[0].Value = paramater1;
param[1] = new SqlParameter("@...", SqlDbType.Int);
param[1].Value = paramater2;
Sql.ExecuteNonQuery(con, CommandType.StoredProcedure, "Store procedure name", param);
}
}
catch (Exception ex)
{
throw ex;
}
}
|
|
|
|
|
Post this question in Database section.
|
|
|
|
|
|
First of all this is the Wrong Section to post this.
Are you talking about different types. If so use NVARCHAR as it takes most of the primitive data types like DateTime, Bit, Int, Float etc.
|
|
|
|
|
hii all...
i hav populated the two dropdown lists from database.
according to the item selected in the dropdown i want to change
the respective textbox value.I hav written code it works for first dropdown but not for second.whenever i change the item in dropdownlist2 it does not show any value in its respective textbox.
plz reply..
the code is:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateDDL1();
PopulateDDL2();
}
}
public void PopulateDDL1()
{
SqlCommand cmd = new SqlCommand("Select * From [Vendor]", new SqlConnection(ConfigurationManager.ConnectionStrings["BillingSystem"].ConnectionString));
cmd.Connection.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
DropDownList1.DataSource = dr;
DropDownList1.DataValueField = "VendorID";
DropDownList1.DataTextField = "VendorID";
DropDownList1.DataBind();
cmd.Connection.Close();
}
public void PopulateDDL2()
{
SqlCommand cmd = new SqlCommand("Select * From [Product]", new SqlConnection(ConfigurationManager.ConnectionStrings["BillingSystem"].ConnectionString));
cmd.Connection.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
DropDownList2.DataSource = dr;
DropDownList2.DataValueField = "ProductID";
DropDownList2.DataTextField = "ProductID";
DropDownList2.DataBind();
cmd.Connection.Close();
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string str = "Select * From Vendor Where(VendorID='" + DropDownList1.SelectedValue + "')";
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataReader dr = null;
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
TextBox1.Text = dr["VendorName"].ToString();
}
conn.Close();
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
string str = "Select * From Product Where(ProductID='" + DropDownList2.SelectedValue + "')";
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataReader dr = null;
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
TextBox3.Text = dr["ProductName"].ToString();
}
conn.Close();
}
|
|
|
|
|
check whether you have given autopostback property to both the dropdown
|
|
|
|