|
Hi, all,
I use Asp.net 2.0.
I create a ImageButton in a gridview row with category ID, when click it I will call function to show or hide all the rows with the same category ID, everything works fine. But the problem is that every time the button is click, the postback is called, how can I stop that? or have any better way to achieve my purpose,
Thanks a lot.
|
|
|
|
|
Are you calling a javascript function to show hide the rows, if yyes just return fasle from that javascript function
|
|
|
|
|
Hi, Brij.
Thank you for your reply.
When click button I call a function in .cs file. Can I avlid postback if use this way?
I also search internet and try to user javascript to solve it, but failed. To access gridview row information like the following, I put it in block.
But this doesn't work, get error "Object Required" in line: rows = document.getElementById(gridName).rows;
also ask a silly question, since the javascript block is inside <head runat = "server"> </head>, it will executed in server side or client side?
Thanks
|
|
|
|
|
Itll be better if you use updatepanel then your posstback wont occur only your grid will be updated.
And how to use updatepanel Have a look
|
|
|
|
|
Hi, Brij,
I got an error "Unknown server tag 'asp:ScriptManager'.", what should I do to use it?
|
|
|
|
|
If you are visual studio 2005, then you need to install Ajaxextentions, Download from here
Then a new template would be added in vs2005, that is ASP.NETAjaxEnabledWebsite create website of that template and it;ll work.
In vs2008 or later it is not required.
|
|
|
|
|
Brij,
Yes, I work on VS2005.
Since I am new to Asp.net, is there any simple way to achieve my purpose instead of AJAX?
Thanks!
|
|
|
|
|
What you can do, you can use Template Field to place ImageButton With in a AJAX Update Panel.
Cheers !
Abhijit Jana | MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Thanks,
I am new to Asp.net, if I use Ajax, do I need to import some new library or third party tool? Basically it
|
|
|
|
|
use Ajax update panel and place your Image button in it..
|
|
|
|
|
I also curious why I cannot use javascript to achieve it. I find some codes by using javascript, but when I try it, doesn't work.
|
|
|
|
|
Hi,
As far i know, You want to show the Master/Detail Grid view. ie, if u click the [more] button (imagebutton), u want to show the detailed/ sub grid. if i caught you correct, let me know, so that i can give u a gud solution.
http://www.progtalk.com/viewarticle.aspx?articleid=54
http://www.giswiz.com/nested_gridview_dropdown/Default.aspx
cheers,
Sam
modified on Thursday, April 22, 2010 3:45 AM
|
|
|
|
|
Sam,
Yes, you are right. I alreay solve my question by using javascript to show/hide group rows in gridview.
I have another question, why the grid always has one more empty row as last row of the gridview grid, how can I avoid it?
Thanks!
|
|
|
|
|
Same,
just like the example in the link you reply, if I expend two category, and keep other collapse, after I click sort button, I still want to keep these two category expend, how can I do that? Do you have any example to this case?
Thanks!
|
|
|
|
|
I have problem whenever i run the Javascript from vb codebehind the script runs after the if condition and msgbox is displayed
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Page.ClientScript.RegisterStartupScript(Me.GetType(), "alert", "compute();", True)
if x > 10 then
..........
else
...........
end if
msgbox "asdfasdf"
End Sub
|
|
|
|
|
hi their,pls anyone could explain me what is cache and how can we implement it in our code?
|
|
|
|
|
|
|
Hi,
ASP.NET caching enables you to create high-performance web applications. You can cache individual objects such as DataSets, and you can also cache objects that you have created yourself. If you have a ASPX page that contains lots of work behind the scenes, you can also do page level caching, or sections of a page if you have user controls inside that page.
When to use caching
If you are recreating information on each page request, caching might be a good idea. But before you go cache-happy, think about how this will effect your application. For example, a news related site might not want to cache its front page for longer than 1 minute, while the actual article can be cached for much longer.
Please check this article:
http://msdn.microsoft.com/en-us/library/18c1wd61(VS.71).aspx
|
|
|
|
|
Search on google or check msdn...anyway r u a beginner then buy a .Net book
|
|
|
|
|
hi their,I wanna to know about state management in asp.net 2.0(c#)
pls tell me why we need it actually?
thank u
|
|
|
|
|
|
man man hey start reading .net book and if u have problem in implementing then post message
|
|
|
|
|
Hi there,
I have a database in access and it contains 10 tables.
I have managed to get a selected table to disply on a webpage using Visual Studio, the Access data source, and the Grid view.
in the grid view I have selected one out of the many tables I have. This displays without a problem
What I am looking to do now is to have the option for the user to select individual fields then the table will reflect the fields selected.
i.e
there is a table with 4 colomns.
1.Car make
2.Car model
3.Engine size
4.Car colour
I presume you will need to use the drop down list.
So in the ist dropdown list the user selects the car make. this will then inturn display all the cars of that make in the grid.
The user can then go on to select a car model, which inturn will select all the cars of that make and model.
the same goes for engine size and colour.
I would like the database to have this functionality for no matter what the select, i.e if they select the car colour first , the table will then show all the cars/makes/models/engine size of that colour.
What is the best way of doing this with access and asp.
Thank you
|
|
|
|
|
So, do I understand that your result table will always display the following columns ?
Make, Model, Engine Size, Color
If so, then you would create 4 drop down lists which would be used to filter the results grid.
Start with this,
1) Place a combo box on your page and fill it with distinct values of car makes.
Your SQL would be something like: "select distinct make from myTable order by make"
2) Create code for the combo box "SelectedIndexChanged" event that would build a new SQL string including the selected value from your combo box in the where clause. Your SQL would be something like "select * from all_cars_table where make = combobox.selectitem"
This should give you a direction to start in ...
Good luck.
|
|
|
|