|
What i want to do is on Click of a button a Input box must show that I get right
When then the user must enter a name into the text box and then I want to save that
Name to a verbal.
I am comfortable in asp.net with Visual Basic But not that good in JavaScript
My code that i have so far -
Protected Sub Button1_Click (ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim script As String = "<script language='javascript'>prompt('Corrective _
Action : ', 'NOTHING')" & "</script>"
Page.RegisterStartupScript("JavaScript", script)
End Sub
This Brings up My Input box but i need to read the value the user enterd.
Regards
Ryno Engelbrecht
|
|
|
|
|
The only way you can hope to do this, is to put a hidden field on your form, then if the input is created. you write javascript to store it's value in the hidden field. Use the CLientID property of the field in VB to work out what it will be called in javascript.
If you have only one control, you could also try hiding it and showing it again using JS.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Christian
Will you be able to maby give me some sample code for this as i think i will work
Regards
Ryno Engelbrecht
|
|
|
|
|
OK, this is off the cuff, and will need debugging.
Add a hidden field called hf1.
In your codebehind write javascript like this
string js = "var hf1 = '" + hf1.ClientID + "';";
Of course, wrap it in javascript tags and insert it into your page. Also, put the following method in
void WriteHidden(tb)
{
var hf = document.getElementById(hf1); // this uses the client Id you wrote
if (hf)
{
hf.value = tb.value; // Not sure about this bit, the property may be 'text' instead of 'value', or even something else. It may also be different between IE and Firefox
}
}
Then write your textbox so it has the following attribute:
onblur="WriteHidden(this);"
Then when the focus leaves the textbox, the textbox is passed to the method, and hopefully, the value is copied to the hidden field. Then you can access this value from the codebehind.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
On a site I’m optimizing I know a lot of DataSets are stored in Viewstate. I need a tool that can help me analyze the contents of the Viwestate so I can localize big Viewstates. A similar tool for analyzing contents of Session and cache data in IIS would be great.
_____________________________
...and justice for all
|
|
|
|
|
Have you looked at ASP.net built in tracing.
|
|
|
|
|
No, i don't think so... How?
_____________________________
...and justice for all
|
|
|
|
|
I am using this variable from the code behind :
public string UserID;
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
MembershipUser myObject = Membership.GetUser();
UserID = myObject.ProviderUserKey.ToString();
}
I am trying to use the variable in the INSERT command in the aspx file but it seems that the following command does not work,any ideas why?
InsertCommand="INSERT INTO table (column1, column2) VALUES (value1, '<%=UserID %>')"
Thanks!
|
|
|
|
|
What about
InsertCommand="INSERT INTO table (column1, column2) VALUES (value1, '" + UserID + "')"
Assuming that you are doing this from within RadGrid1_PreRender routine.
|
|
|
|
|
Thnx for answering but I want to use the variable in the aspx file not in the code behind file.
|
|
|
|
|
It would help if you defined 'does not work', but I thought that using code blocks like this only worked for properties, not for public variables.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
What I mean is that if I use sql management studio and enter the insert query manually there is no problem.
|
|
|
|
|
But what *is* the problem ? Is the value being passed back blank ? Is it incorrect ? Does it blow up ?
Did you try using a property ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Can you give me a sample .aspx code of properly passing a value from the code behind?
Thank you!
|
|
|
|
|
int _n; // this is a variable
protected int N
{
get { return _n; } // this is a property
}
Wrap your variable in a property and then access the property.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi All,
I Have two web site written in Framework 1.1 and I have web site written in visual Studio 2005 How I can make master page to call all pages which written in Framework 1.1 within ContentPlaceholder in MSVS 2005 Site Master Page.
Ala Qunaibi
|
|
|
|
|
You can't. There were changes between 1.1 and 2.0 that mean you surely cannot just compile in 2.0 without code changes, and to use a master page, you need to run it under 2.0, obviously.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi All
I have a data reader that reads data from an SQL Server table, I need to move the cursor of the data reader to the last record..
(there is no dr1.movelast)
How could it be?
Luv ya
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
I am guessing your best bet is to read each row until you come to the last one, then use the last one you read. A better way would be to write SQL that returns just the data you need.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Dear
Here is the code
cm.CommandText = "select * From News"
dr = cm.ExecuteReader()
If dr.HasRows = False Then
Label2.Text = "No News..."
End If
Do While dr.Read
'here is the problem, I need the data for the last record
' and this code gives me the first one
Label2.Text = dr.GetString(1)
Label3.Text = dr.GetString(2)
Label4.Text = dr.GetString(4)
Label5.Text = dr.GetString(5)
Label6.Text = dr.GetString(7)
Label7.Text = dr.GetString(8)
Loop
Regards...
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
Well, like I said, fix your code. You are selecting news without specifying any sort order. I assume they will come out by Id. So, select by Id in descending order. If you don't have an Id, add one.
This code is bad on a number of levels, I would recommend you do some reading on things like writing a proper data layer, giving your variables proper names so that your code is maintainable, etc.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
thanks alot
it works
luv ya **
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
iam having a linkbutton where i wrote some javascript for that using onclientclick.even when the button is in disabled mode also the javascript
is firing how to stop this
|
|
|
|
|
Why don't u write on Page load ...........
<br />
LinkButton.Attributes.Add("onclick","Your JavaScript");<br />
instead of using onclientclick,
Did u disable the button in Code Behind?? In that scenerio sometimes it does not recognise enable/disable in JavaScript
|
|
|
|
|
Hi
I am working on ASP.net application and using AJAX.net.
if i am runing my application on firefox then my page_load is being called when I click on button (that calls ajax method )
while with IE its working fine (not loading the page again).
is there any work around for this......
Thanks
Dinesh Sharma
|
|
|
|