|
Hi Chris,
It sounds like you're going to be best served by looking into CSS Adapters, which allow you to override the rendering of ASP.NET controls. Scott Guthrie has a good overview [^] that may help you get started. Microsoft has also released some reference adapters[^] and a toolkit [^] that may prove helpful. A google[^] search for ASP.NET CSS Adapters will net you lots of hits.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
The asp.net menu control has a MenuItemDataBound event which allows you to access each menu item as the menu is being databound.
As this event triggers you can modify the properties of the menu item as you require.
protected void MainMenu_MenuItemDataBound(object sender, MenuEventArgs e)
{
MenuItem mi = e.Item;
mi.Text = .... do stuff here ...
}
|
|
|
|
|
Hi, I wrote this code for sending mail:
Dim message As New MailMessage()
message.Body = txtBody.Text
Dim mailAdrs As New MailAddress(txtEmailSender.Text, txtSender.Text)
message.From = mailAdrs
message.Subject = txtSubject.Text
Dim con As New SqlConnection()
con.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("DrMasanConnectionString").ConnectionString
Dim com As New SqlCommand()
com.CommandText = "Select Email From [User]"
com.Connection = con
con.Open()
Dim reader As SqlDataReader = com.ExecuteReader()
While reader.Read()
message.To.Add(reader("Email"))
End While
Dim smtpC As New SmtpClient()
smtpC.Host = "drmasan.com"
smtpC.Send(message)
But this error appears:
No connection could be made because the target machine actively refused it 72.36.140.90:25
Why?
Best wishes
|
|
|
|
|
could be a port problem, check the port is allowing connection
|
|
|
|
|
I have two pages default page with two textbox and one button which when u click will take u to second page.
Second page with a button which will take u to default page. I have to get the text of textbox when I come back from second page to defaultpage using session
|
|
|
|
|
The easiest way to accomplish what you are looking to do, would be to put some code in the click handler of the button that is responsible for performing your redirection. In that code, you'll simply read the current value from your textbox and place it into Session .
In your default page's Load event handler, test for postback. If the current request is not a postback, attempt to read the textbox value from Session and restore it. The code to do so would look something like:
protected void Page_Load(object sender, EventArgs ea) { if ((!this.IsPostBack) && (!String.IsNullOrEmpty(Session["MY_DEFAULT_TEXTBOX_VALUE"])) { this.MyTextBox.Text = Session["MY_DEFAULT_TEXTBOX_VALUE"]; } } protected void Button_Click(object sender, EventArgs ea) { Session["MY_DEFAULT_TEXTBOX_VALUE"] = this.MyTextBox.Text; Response.Redirect("mysecondpage.aspx"); }
I'm assuming that you're performing your redirection from the server-side. I have also made the assumption that you are either not working in a web farm scenario, have IP affinity set, or are using SQL session management. If any of those are not the case, please note it and we can discuss some alternatives.
Hope that helps.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
When i wrote the code below it is giving syntax error in if statement saying ; expected .I am using c#.
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack )&&(!String.IsNullOrEmpty(Session["FirstName"])) && (!String.IsNullOrEmpty(Session["LastName"] ))
{
TextBox1.Text = Session["FirstName"].ToString();
TextBox2.Text = Session["LastName"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Session["FirstName"] = TextBox1.Text.ToString ();
Session["LastName"] = TextBox2.Text.ToString ();
Response.Redirect("~/language.aspx" );
}
}
|
|
|
|
|
If you were to troubleshoot the compiler message, I suspect that you'd find that you are missing the enclosing parenthesis around the compound conditions of your if clause.
--Jesse "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi
|
|
|
|
|
It is saying invalid expression &&. In c# is it && using for 'and' operator or I have to write like
If(!IsPostBack && !String.IsNullOrEmpty(Session["FirstName"]) && !String.IsNullOrEmpty(Session["LastName"]))
Not closing each condition. Even if I write like this another syntax error
|
|
|
|
|
Just use Session["something"] = textbox.text to put the value in a asession and use it on a different page
|
|
|
|
|
i have two aspx pages , one form is child of another , if i am in the first form , can i programically , refresh the second one.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
you can use this to refresh:
Response.AppendHeader("Refresh", "60;URL=Page.aspx");
or this
this might help you
|
|
|
|
|
.netman wrote: Response.AppendHeader("Refresh", "60;URL=Page.aspx");
is it working at ur side.
i tried this code at button click. both the forms are open.
It is not working.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
If you open a child form with javascript you have a reference to the new window.
You can use this reference to reset the location of the child window, therefore refreshing it.
<script type="text/javascript">
var childWindow;
function openPop()
{
childWindow = window.open('HTMLPage2.htm','name','height=400,width=200');
}
function refreshPop()
{
childWindow.location = childWindow.location;
}
</script>
|
|
|
|
|
Following is the code i am using to alert the user to press ok or cancel in the c# code behind file
string str = "confirm('ok?');";<br />
ScriptManager.RegisterStartupScript(this, typeof(Page), "", str, true);
i know , i can do the same at the java script end , I am asking this because i am executing these lines in between the function .
Now my question is can i programatically check whether the ok button is clicked or the cancel button is clicked ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
So, this just gets run wen they page loads ? And you want to know where, what was pressed ? Why would you have a page reload so you can show a confirm dialog ?
Obviously, if you don't store the button result somewhere, your code behind is never going to know what it was.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Sir , i am executing these lines on the button click , there in the function , these lines executes after five lines ,
Christian Graus wrote: Obviously, if you don't store the button result somewhere, your code behind is never going to know what it was.
Sir , i don;t know how to store the message box button result , can u put some light .
Thank You
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
OK, so you just didn't post all the code ?
The best way to pass a value back to your codebehind is to store it in a hidden field. Then yuo need to write the client side Id of the hidden field so you can access it from your script ( easy, seeing as you're spitting out your script from your code behind already )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
First i am sorry for these cross questioning , But i don't believe it is a bad idea until the question gets resolved.
Is ur suggestion valid if i am not writing script in the html , i mean i am writing it in the code behind , can i still store the value in hidden field ? How ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Pankaj Garg wrote: Is ur suggestion valid if i am not writing script in the html , i mean i am writing it in the code behind , can i still store the value in hidden field ? How ?
Why would it make any difference where the script comes from ? Either way, you need a server control, which is a hidden field, and you need to have the client side id of that control, in your script, so you can store a value in it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Couldnt you just check if the string contained Yes or No? or am I missing the point
|
|
|
|
|
sir i did not get ur point
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas
|
|
|
|
|
Dim str As String = "var i=confirm('ok?');alert(i);"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "message", str, True) ---try this one mr
|
|
|
|
|
how should i use the value of i in the conditional operator (code behind file)
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
iam using an iframe which is editable it is working fine but the when iam pressing enter it is getting the cursor long distacnce in the before word how to get that cursor closer bottom to the top text ...
in my ifame it is looking like this when press enter
example1
emamle 2 like this it is comming how can i make it closer.like our code project sending message
|
|
|
|