|
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.
|
|
|
|
|
I'm missing something obvious here as it seems the gridview.columns doesn't hold anything. I got a count of the columns with GridView4.Columns.Count and the count just after I bind it is 0 even though there are many columns on the screen in the gridview. Time for lunch!
|
|
|
|
|
OK, what you have to do is to remove the columns from the datasource i.e. in your datasource you have to select only the coulmns that you need to show.
OR set the autogeneratecolumns = false, use <asp:boundfield id="test" headertext="test" ........="" and="" so="" on="" create="" all="" columns="" like="" this="" in="" your="" html="" page,="" then="" before="" binding="" or="" after="" hide="" the="" that="" you="" don't="" need="" (gridview.columns(i).visible="true/false)..."
<div="" class="ForumSig">-----
|
|
|
|
|
Not sure if this will be your problem but the DataGrid control essentially had a NULL column collection when the AutoGenerateColumns property was true and I believe this behaviour is the same with a GridView.
Essentially you'll not get a columns collection with AutoGenerateColumns set to true.
Rhys
A cult is a religion with no political power.
Tom Wolfe
Behind every argument is someone's ignorance.
Louis D. Brandeis
|
|
|
|
|
how to close modal dialouge box in runtime of the page
eg;
i have popup.aspx a modal dialouge box and it have some vb code
how can i close the popup.aspx page while executing the vb code
thks
|
|
|
|
|
AFAIK modal dialog is on client so cannot close it using vb code. you have to use javascript which you will call on onunload of body something like it..
when you open a dialog open it like
modaldlog = window.showMOdalDi... (where modaldlog is global var to page)
on unload of parent page
if(modaldlog){modaldlog.close();}
-----
|
|
|
|
|
Hi, I Just Started to build this project. Everything is going on well until I came to user login page. I am getting a error msg Error 1 'ASP.login_aspx' does not contain a definition for 'Login1_Authenticate' File: Login.aspx Line 24
May be I need a code to authenticate username and password.
Can someone provide me a good code for this in C#
Database is already created as ASPNETDB.MDF for login user ids.(automatically created through login tool box)
I am using .NET 2005 to develop this.
Thanks
|
|
|
|
|
Sounds like you login control has an event property set but you don't have the method it refers to in your code-behind. Have a look in the markup of the aspx page for Login1_Authenticate
|
|
|
|