|
Getting the javascript onUnload handler to work from a master page is easy. Getting the javascript to call a C# function on a asp.net page is what I'm asking about.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
This is kind of a lame solution, but if you have some sort of Close button on the browser itself, it would be easy enough to have the javascript call the click event on that button. I am just curious what sort of clean up are you thinking about doing?
Ben
|
|
|
|
|
What will you do if they have Scripting disabled?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
I have the page break problem in my report. In the report first I placed a table with contains 50 rows(data will be shown in two pages) and after the table I placed the matrix object becuase the number of cols is not fixex. The problem is that if the number of columns in the matrix is greater than 10 then it prints the remaining columns in the next page but at the same I am getting the page breaks in the first table i.e between 1St and 2nd page I am getting page break.
How can I delete the page breaks.
Kalyan
|
|
|
|
|
Hi,
I am trying to cache a custom control so that I do not have to call LoadControl ("MyControl.ascx" ) every time my OnInit function is called. So, I do this:
object cachedctrl = Session["cachedcontrol"];
if ( cachedctrl != null ) <br />
{ <br />
Controls.Add ( (Control)cachedctrl ); <br />
return; <br />
} <br />
Control ctrl = LoadControl ( "MyControl.ascx" ); <br />
Controls.Add ( ctrl ); <br />
<br />
Session["cachedcontrol"] = ctrl;
It kinda works, except that the viewstate for the page is lost when I load it from the cache!
can anybody explain why this is happening and suggest a workaround?
thank you.
|
|
|
|
|
I cant explain what is happening but I will ask this. Why are you calling LoadControl everytime the OnInit function is called? And when you say Custom Control do you really mean User Control?
Example of LoadControl Use[^]
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Yes, sorry, when I say Custom Control I mean User Control.
I call LoadControl at every OnInit because I thought this was the way I was suppose to add dynamic controls to a page.
is it not the right way?
|
|
|
|
|
According to that link that is the way to add them IF you are planning on changing them at runtime if some criteria is met. If not then just drag the User Control onto the page and it will always come up without that call.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Right. I plan to change them at runtime when some criteria is met.
Now how to I cache them so that I do not have to call LoadControl all the time?
I have it working somewhat, but the viewstate for the page is lost when I add the controls from my cached collection.
|
|
|
|
|
helloo all
I have webform and textboxs and i added Validators to vaild textbox
and i added server button2 (webcontrol)..
I went when i click to button2 to cancel vaildation and make postback process
i try to add button22.attribute.add("vd()","")
i want to write javascript to cancel validation
function vd()
{
page_activevalidation=false()
}
how can do it excatly
thanks
|
|
|
|
|
Set the buttons CausesValidation property to false.
|
|
|
|
|
|
Its a property of the button control. Do you know how to set properties of an ASP.NET control?
|
|
|
|
|
yes thanks it works
but i want to ask u other question
how can I make javescript fuction to run by clicking on server button control
,,and Iwant to make vaildation fuction using javascript if the page is not vaild canel postback
|
|
|
|
|
On the server-side:
Button1.Attributes.Add("onclick", "MyFunction()");
On the client-side:
function MyFunction()
{
//do something here
if (valid)
return true;
else
return false;
//return false, to cancel postback
}
|
|
|
|
|
How do you do if you want to daclare a variable to be type "time"(10:00) and how do you use operators to minus or add value to that variable
nzibi
|
|
|
|
|
Do you need to simply display the time or to manipulate the time?
Datevariable.Addhours(1) and Datevariable.Addhours(-1) will manipulate that time and there are similar functions for days, years, minutes, etc...
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
You want System.DateTime (check the docs for the method you want, they're all there!)
|
|
|
|
|
I need guidance on Identifying Users in IIS using Exchange and LDAP. Any assistance would be greatly appreciated.
|
|
|
|
|
Running Vista ( business ) , SQl 2005 and VS 2005 (VB.net)
I apoliguise if this is posted in the wrong forum
Ok im trying to create an asp.net page that has a 'text' box on it ( no data grid ). in the vb code ( i believe its called code behind ) i have connected to a data source and created a data table - dt .. ( code below ). Ive been looking at lots of different articles and all i manage is to go in circles.
Is it possible to write all the 'code behind' and just bind the data to a text box and if so using the code below how can i bind the field Licence to the text box StrLicence
Alternatly would it be more productive to look at just the asp code, and if so how can i do the same with out using the Form View
Any help would be most appriciated
Vb code
Dim Conn As SqlConnection = New SqlConnection(connectionString)
Try
Conn.Open()
Response.Write("SQL Connection = " & Conn.State.ToString)
Dim Adapter As SqlDataAdapter = New SqlDataAdapter(SelectCommand, Conn)
Try
Adapter.Fill(dt)
Response.Write("Filled Data Table")
Catch ex1 As Exception
Response.Write(ex1.Message)
End Try
Catch ex As Exception
Response.Write(ex.Message)
End Try
dt = Nothing
Conn.Close()
Conn = Nothing
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
If all you need is to bind one field from the data base, then filling a datatable may be a bit too much overhead.
But, with your above code, you should be able to bind your text box something like:
<br />
strLicense.text = dt.Rows(0).Items(indexOfYourColumn)
I think that's the syntax, don't have anything handy to check it on.
|
|
|
|
|
Hi Paddy
Thanks for the reply,
Thats a way forward for me, tho i must admit i havent made it fully clear on what im trying to do. I onlu used one text box as an example, there will be about 20 in total with some 300 records in the table, which i need to navigate through, hence i was trying to bind to the text box to the table
Thanks again, i can now see a way forwards
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Buy a book, or read some articles. In all honesty, stumbling along blindly is just going to cause you all manner of problems...
Doing a wee bit of proper learning and then coding what you need will probably take you about the same time as bumbling along writing buggy code.
|
|
|
|
|
Hello
How can i get previous url in asp.net or javascript. ? I need to track my website visitors from which search keyword they are coming. if they search for mywebsite in google and they clicked on mywebsite link, i need to get the keyword what they searched to reach this page ? any idea ?
|
|
|
|
|
Googled it[^]
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|