|
you have to install ajax extensions [http://ajax.asp.net/[^] and then add system.web.extensions as references in your project...
-----
|
|
|
|
|
Hello fools.
Dim NewListBidAmount As Double = PostBidAmountTextBox.Text
I have the following code taking a value from a text box and using it else where. The value is a monetary value and therefore should only have two places after the decimal point. If I type in more than two places though the addtional places are stll shown when displayed and used elsewhere. How can I eradicate any digits that occur after the first two places after the .?
Thanks
|
|
|
|
|
use formatcurrency(amount,2) before displaying it ..
-----
|
|
|
|
|
I had a project where I needed to restrict decimal point places also. I wrote this method:
Public Sub RestrictDecimalPlaces(ByVal txtSender As TextBox, ByVal intPlacesToTheRight As Integer)
'***********************************************************************************
' This function will ensure that only one decimal point is allowed in a text box
' and that the user may only type in a certain number of digits to the right of
' the decimal point (as specified by the intPlacesToTheRight parm).
'***********************************************************************************
If txtSender.TextLength <> 0 Then
Dim strTemp As String = txtSender.Text
Dim straTemp() As String
straTemp = strTemp.Split(".")
Select Case straTemp.Length
Case 1
'No decimal point, so no problem
Return
Case 2
'One decimal point, ensure specified chars to the right
Select Case straTemp(1).Length
Case Is > intPlacesToTheRight
txtSender.Text = straTemp(0) & "." & straTemp(1).PadRight(intPlacesToTheRight, "0").Substring(0, intPlacesToTheRight)
txtSender.SelectionStart = txtSender.Text.Length
End Select
Case Else
'More than one decimal point, remove extra
txtSender.Text = straTemp(0) & "." & straTemp(1)
txtSender.SelectionStart = txtSender.Text.Length
End Select
End If
End Sub
And used it in the KeyPress Event of textboxes I wanted to restrict, like this:
Private Sub txtInput_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtInput.KeyUp
RestrictDecimalPlaces(sender, 4)
End Sub
However, I know this code still has some quirks...and it won't help when the user does a copy and paste into the textbox, so you will want to modify it or use other edits as well. Hope this helps.
|
|
|
|
|
|
|
Hi,
i would really need to know how could a javascript method call another method written in a c# script at the same client ofcourse!!
or if any one could help me in a highlighting function in javascript?
your responces are highly appreciated..
Thanx
|
|
|
|
|
you cannot call a server function from client without postback.
I don't what you want to do. to highlight a row you have to add onclick attribute to the row on rowdatabound and in that function (javascript) you can do row.style.backgroundColor = 'blue'
-----
|
|
|
|
|
To talk between the client and server, you'd have to psotback, or use AJAX....
There's no way to simply "call" a server side funciton from the client
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Thanks all for replies
my question is if i can call a c# script method from the javascript on the client, NOT a server method..
its bcus i wrote my code in c# script and i found out that the java script is going to deal with it too, i don't know if there's some way but i could'nt found any yet!!
thanks all again..
|
|
|
|
|
Right then - think you're labouring under a misapprehension here - your c# code IS NOT RUNNING ON THE CLIENT - it's on the server - the fact that it's in the same page as the markup and the js is immeterial - look for the runat=server / <% %> indicators = both mean the code is ACTUALLY executing on the server.
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I'm working with Visual Studio Express 2005 and ASP.NET.
I want to handle mousevent (like mouse move) over a panel or image object, is it possible? I'm referring to Web not to Window.Form (c# for window),
Any example?
|
|
|
|
|
add attribute to the panel (panel1.attributes.add("onmousemove","javascript:onMouseMoveEvent();")
now you have to create onMouseMoveEvent in javascript and do whatever you want to do as per your login in this fucntion.
-----
|
|
|
|
|
but how can interact from javascript to ASP.NET? For example if i want draw a selection rectangle over a panel i've to handle mousemove from javascript, but i need coordinate referred to the panel position, then handle the drawing above the pannel from onPainEvent, how?
|
|
|
|
|
the coordinates you can get by event.clientX and event.clientY or event.x, event.y, but can you please describe what you are trying to do?
You may look at the following [http://w3schools.com/js/js_examples_3.asp[^] for event object in javascript..
-----
|
|
|
|
|
think having an image on the webpage, i can click over a point of it then drag the mouse to get a selection box, i want do make that
-- modified at 19:48 Monday 12th March, 2007
|
|
|
|
|
I think it is possible, go on the properites window and look at the the lighting sign that's where all the predefined event are delcared.
|
|
|
|
|
no mouse event in property
|
|
|
|
|
Hello
I am creating Dynamic HTML controls using javascript and filling data from ajax.
When post back i cannot access the html controls like text box and combo box using request.form() and those dynamic controls.
How to access dynamically created HTML Controls on Client side on Server side after the page is submited?
Need help Urgently
thanks and regards
Help in need is the help indeed
|
|
|
|
|
AFAIK controls added on client are not accessible on server unless there is way to modify viewstate on client (I don't think you can do it). A better way to achieve something like you want is to create the controls on server and show them or hide them on client as per your logic/requirement.
-----
|
|
|
|
|
Have you assigned id attributes to the elements? Try checking the request sent to the server to check what POST variables its sending (using a tool like Firebug and/or Fiddler)
|
|
|
|
|
Thank you very much for the reply.
Yes i have assigned both name and id attributes for the controls i have created.
But not showing in the key Collections in request.form. It only shows the Items that i created as server controls.
Help in need is the help indeed
|
|
|
|
|
I have a gridview that is populated dynamically based on a drop down by setting the Source to an ObjectDataSource. I want to pull the exact same results in two of the cases from the BLL which pulls from the same get method of one of the table adapters but I want to hide a couple of the columns. Here are four lines of code that I use to bind the gridview but if I try to use GridView3.Columns.RemoveAt(0) or GridView3.Columns.Remove("FirstColumn") I get errors. Can anyone help me with this?
ObjectDataSource1.TypeName = "QAReportsBLL";
ObjectDataSource1.SelectMethod = "GetQARptABCD1";
GridView3.DataSourceID = ObjectDataSource1.ID;
//GridView3.Columns.RemoveAt(1);
GridView3.DataBind();
If I uncomment out the RemoveAt line I get this error...
Error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index .
The table has about 15 columns and I have autogenerate columns set to true.
|
|
|
|
|
AFAIK you have two options:
1. set autogeneratecoulumns = false and then generate the columns dynamically (requires a quite of extra code to change your current approach)
2. set the visible property of column to true or false depending on your logic/requirement (gridview.columns(i).visible = true or false )
-----
|
|
|
|
|
Setting the visible property = false seems to be the best choice but I'm still having issues with that.
Adding this line generated the same error
GridView4.Columns[1].Visible = false;
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
I'm doing this right after databind() and also tried in page_load but I'm not having much luck.
|
|
|
|