|
I need to show an confirmation message inside a button click event but only for a particular condition.
Not always it should show when the button is clicked. Inside the click event handler i will call a method and depending upon the return value of that method i need to show a confirmation message.
How should i do it???
Kindly provide me an idea???
Thanks,
Srikanth
|
|
|
|
|
Use this function
and call the string required.......
public void MsgBox(String str)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("");
sb.Append(@"alert( """ + str + @""" );");
sb.Append(@"");
HttpContext.Current.Response.Write(sb.ToString());
}
R A J A S E K H A R
|
|
|
|
|
if(condition==true)
{
this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "key", "alert('Condition is true')", true);
}
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
i dont want an alert message.
If the condition is true,say
private void button1_click(object s,EventArgs e)
{
if(Condition == true)
{
//show confirmation messagei.e with yes no option;
//If user click yes continue
// if user clicks no return from the event
}
}
Thanks,
Srikanth
|
|
|
|
|
Sri_3464 wrote: //If user click yes continue
// if user clicks no return from the event
I think this might not be possible. When user clicks ok button, page will be posted again AFAIK. Have you tried this ? Replace the alert with confirm
|
|
|
|
|
Try this:
public void MsgBox(String str)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script language = 'javascript'>");
sb.Append(@"if(confirm('Are you sure you want to delete your selection(s)?'){ return true; } else{ return false; })");
sb.Append(@"</script>");
HttpContext.Current.Response.Write(sb.ToString());
}
|
|
|
|
|
so try this
if(condition==true)
{
this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "key", "return confirm('Condition is true')", true);
}
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
That is not possible.
The server code is executed on the server to create the response, then the response is sent to the browser. The server code in the page is executed completely, then the response is sent to the browser. If you put code in the resposne that shows a confirmation message, that will not be shown until after the code in the page has been run to completion on the server.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hello every body,
I am using sessions in my web-based application. After completion of all transactions i want to sign out. When i click sign out and copy the URL and paste it in browser. It is showing the contents of signed-in page.
Even I have used "Session.RemoveAll();" in global.asax file when the session ends
But If i click refresh and paste the URL it will not allow to show the contents of signed-in page.
How to refresh page once when i click sign-out
Can any body plz..help me...
|
|
|
|
|
srajasekhar wrote: I am using sessions in my web-based application. After completion of all transactions i want to sign out. When i click sign out and copy the URL and paste it in browser. It is showing the contents of signed-in page.
You are seeing a cached preview of the page by browser. But it won't allow you to proceed further since you are checking session on page_load .
srajasekhar wrote: How to refresh page once when i click sign-out
This is not possible. If you add refresh code in the page, all the time it will refresh, not only when signing out
|
|
|
|
|
I want to retrieves value in textboxes using SQLDataAdapter. whatever row i want to retrieves
i am using this command Select * from mytable where Name="+TextBox5.Text"
|
|
|
|
|
dikshant@p-dd.com wrote: Select * from mytable where Name="+TextBox5.Text"
SqlAdapater is having a Fill() method which fills a DataSet. Use this to fetch data from database.
|
|
|
|
|
I was trying to make my .aspx pages secure so I set access levels on the web.config
<authorization>
<deny users="?">
I have a login screen which uses a .css file but cannot access the .css file. What can I do?
|
|
|
|
|
hi,
how can i place the checkboxes inside the listbox and these checkbox values should come from Database..using asp.net
and if i select the multiple checkboxes ..those ids should be inserted in to the database..
how can do these things in asp.net
Ramesh
|
|
|
|
|
Use a GridView/DataGrid for this.
|
|
|
|
|
Hi friends
I want to know how to make collapsible property for custom control.
just like as every control has collapsible 'font' property.
thanks in advance
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Imran Khan Pathan wrote: I want to know how to make collapsible property
Do you want to make a collapsible control ? Check out[^] my article
|
|
|
|
|
thanks navneeth.
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
|
hi,
i have developed one web application,in
this application i have used excel template
for reports,
i can access this excel template on my system,
if u run this application from another system,
every thing is working fine but excel template
is not opening on another system,
can anybody knows how can i do this,
plz reply if u know
thanks in advance
Afreen
|
|
|
|
|
afreen taj wrote: excel template
is not opening on another system,
Where it is stored ?
|
|
|
|
|
in my system,
i.e "C:\Inetpub\wwwroot\sts_project\dispatchtemp.xls"
where sts_project is application name and
dispatchtemp.xls is excel template,
i wnt to open dis template on another machine,
wht path is have specify,if u know
plz reply me
thnks
Afreen
|
|
|
|
|
How you are trying to open it ? Through ASP.NET ? Just redirect to the file path, browser will ask for the save dialog box, and save the file in any location.
|
|
|
|
|
hi,
i m new to developing,
plz can u tell me how i
have to do dis
(if possible send code)
thanks
Afreen
|
|
|
|
|
afreen taj wrote: i m new to developing,
Buy a good book and learn the basics. These all are basics, and I don't think that you will get help by posting to forums.
|
|
|
|