|
I have a web form which has some radiobuttons in it. it looks like this:
asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" Checked="True" GroupName="aa" Text="r1"
asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" GroupName="aa" Text="r2"
asp:RadioButton ID="RadioButton3" runat="server" AutoPostBack="True" GroupName="aa" Text="r3"
asp:Label ID="Label1" runat="server"
in the vb file,
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.RadioButton1.Checked Then
Me.Label1.Text = "r1 is selected"
ElseIf Me.RadioButton2.Checked Then
Me.Label1.Text = "r2 is selected"
ElseIf Me.RadioButton3.Checked Then
Me.Label1.Text = "r3 is selected"
End If
End Sub
when the page is loaded, r1 is selected, then I click r2 and r3, then click BACK button in Internet explorer, the label text changed correctly, but not radiobutton selection. Can anybody explain it? and is there anyway to fix this?
thanks,
|
|
|
|
|
So let's say I have a Search textbox on a page and a login textbox on a page. When I hit the enter key on the keyboard I want it to fire the login button click event when the cursor is in the login textbox and fire the search button click event when the cursor is in the search textbox.
How does one handle that? I found some vague references in google about using javascript for this, but is there any C# asp.net native ways of doing this?
If js is the only way can someone post an example or a good url of where this is covered?
Thank you
|
|
|
|
|
u have to capture the key press event and you have to check the condition whether enter is pressed or not if pressed you have to dopostback on the control you want following the is the example to capture event.
in you aspx page under the for tag place your text box
<asp:textbox id="textBoxName" runat="server">
in page load event write the following code
If Not Me.IsPostBack() Then
textBoxName.Attributes.Add("onKeyDown", "javascript:checkEvent();")
End If
in your aspx page under the HEAD tag write the following javascript code
function checkEvent()
{
alert(window.event.keyCode);
if (window.event.keyCode==13)
{
__doPostBack("controlname",""); //please check the code i used to do like this only make sure view state of your control is true this is code i have used and it is working fone for me
}
}
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
Hello Everyone,
Can anybody let me know how to solve this problem
Actually,i have designed a flash header and above this header i've designed a drop-down menu but the problem is whenever i drag my mouse over the dropdown then dropdown don't display clearly because of flash header the drop-down menu hides under the flash-header
Please suggest me some great ways
Thnx in advance
|
|
|
|
|
|
Hi, my requirement is to give users access to pick what fields or columns (these columns may be in few different tables) to select and the criteria of the report. Once they pick that, I would need to generate a SQL and run the report. I am not sure what the best approach is for this in ASP.net. Can anybody please help me.
Thanks,
Madhu.
|
|
|
|
|
madhu07 wrote: Hi, my requirement is to give users access to pick what fields or columns (these columns may be in few different tables)
If you allow users to select the columns on different table, on what criteria you will link the tables ? I mean when writing query what will be the condition you use in where clause ?
|
|
|
|
|
Thank you very much. I am going to join the tables and give users list of fields for them to select.
|
|
|
|
|
Hello
I need to count how many users are active in the website. Do you have any idea on this. I did using application variable. On session_start event in global.asax I am incrementing the application variable count and session_end event I am decreasing the count. But problem is when user closes browser no event will be fired. So I am not able to reduce the application variable count. It will show the old result. Do you know any method to handle this efficiently.
I am changing the application variable like this
Application.Lock();
Application["count"] = Application["count"] + 1;
Application.UnLock();
I know lock method stops modifying the variable value at same time. But what will happen if two users request at same time ? Will the second request wait's till application variable get unlocked ? Or that request will be skipped ??
|
|
|
|
|
This can be achived thru AJAX by doing the following
function saveSessionInfo()<br />
{<br />
if (window.event.clientX < 0 && window.event.clientY < 0)<br />
{<br />
AJAXMethods.CallAJAXMethod1(callback_saveSessionInfo);<br />
}<br />
}
call this method like
write your session handling end code here in this method
AJAXMethods.CallAJAXMethod1()<br />
{<br />
}
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hai every one,
i want to get a system user name,
if i deploy to iis i am not getting system user name.
i wont turn off anonymous as well as i get system user name
Dhatchinamoorthy.R
9894824838
|
|
|
|
|
I don't think it is possible to get the user name if you have enabled anonymous access.
|
|
|
|
|
Don't Repost.
Regards,
Satips.
|
|
|
|
|
Hi all,
I have a Checkbox list. I populate this in codebehind...
How can i call a javascript function when mouse is moved over a listitem...
To this function i want to pass the value of the list item.
It would be great if this is solved...
Thanks in advance.
|
|
|
|
|
hello abraham,
in the checkbox list write like this:
<asp:checkboxlist id="chk1" runat="server" onmouseover="javascript:validation(id)">
call that javascript function in the script code
ok byeee
murali
|
|
|
|
|
<asp:checkboxlist id="chk" runat="server" onmouseover="javascript:validation(id)">
Murali
|
|
|
|
|
Sorry,
I Couldn’t get you. Can u send an example.
Thanks
|
|
|
|
|
<asp:checkboxlist id="chk" runat="server" onmouseover="javascript:validation(id)">
|
|
|
|
|
|
write the following code
CheckBoxList1.Items(0).Attributes.Add("onmousemove","javascript:yourfunction()")
in javascript function you can pass whatever you want
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
Hi Prakash,
Thanks for your reply...
I did as u suggested...
But no event is attached to the listitems.
When i right click and view the HTML source, it looks like this...
No javascript event is attached to the list items...
|
|
|
|
|
I have test the below code i am apology on you giving the wrong code dont add items(0) you can directly add the attribute to your checkbox list it will work for all the items under the checkbox list.
checkBoxListTest.Attributes.Add("onmouseover", "javascript:alert('hellow');")
this code might solve your problem
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
I guess if you are not passing any arguments to the javascript function you can just go to the source and add
<asp:checkboxlist id="chkbox1" runat="server" onmouseover="function_name()">
It will take the javascript automatically.
But obviously if you wanna pass a parameter you have to uise attributes.add..
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Hi I am working on a website where I want code for Upload File......
Means there is a textbox and two button......
After clicking browse button File browser will appear and
a file select as user wish and after that
by clicking update button file get uploaded
at specific location at website......
Please try to help me......
Thanks
Rajesh Jain
|
|
|
|
|
I think i have solved your problem
note filMyFile is a file control id
// Check to see if file was uploaded
if( filMyFile.PostedFile != null )
{
// Get a reference to PostedFile object
HttpPostedFile myFile = filMyFile.PostedFile;
// Get size of uploaded file
int nFileLen = myFile.ContentLength;
// make sure the size of the file is > 0
if( nFileLen > 0 )
{
// Allocate a buffer for reading of the file
byte[] myData = new byte[nFileLen];
// Read uploaded file from the Stream
myFile.InputStream.Read(myData, 0, nFileLen);
// Create a name for the file to store
string strFilename = Path.GetFileName(myFile.FileName);
// Write data into a file
WriteToFile(Server.MapPath(strFilename), ref myData);
}
}
Thanks
Warm Regards
Prakash-B
|
|
|
|