473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Client side scripting with asp datagrid

If it's possible I would like to perform some client side actions on my
Visual Basic asp.net application. An example of what I'm trying to do.

I have a DATAGRID with columns ITEM, ITEMTYPE and a template column with a
checkbox in it called "MATCH"
Example

ITEM ITEMTYPE MATCH
Banana Fruit [ ]
Vegatable [ ]
Mineral [ ]
Sprouts Fruit [ ]
Vegatable [ ]
Mineral [ ]

If for example the user clicks the Fruit checkbox against the Banana, then
ideally I would like disable the checkbox against Vegatable and Mineral
within the banana grouping, because I do not want the user to select
multiples within the ITEM grouping.

Is this possible with I guess client side scripting? I have not done much
client side so any hints would be appreciated.

Thanks
Paul


Nov 18 '05 #1
2 1444
Hi Paul,

you can do something like this...
<asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"
Width="25px"></ItemStyle>
<ItemTemplate>
<input type="checkbox" id="chkItem" name="chkItem"
runat="server" value='<%#DataBinder.Eval(Container.DataItem, "FruitId") %>'
onclick="<javascript:functionfruit(this)>">
</ItemTemplate>
</asp:TemplateColumn>

Have some naming convention for your checkbox(eg: join the main and sub
category with underscore). In the javascript function pass this as
parameter. Somthing like below,

<script>
function functionfruit(obj)
{
alert(obj.id);
}
</script>

you will be having control on which checkbox you checked. based on which
you can handle your scenario.

Regards,
Kannan

"Paul" <xx@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If it's possible I would like to perform some client side actions on my
Visual Basic asp.net application. An example of what I'm trying to do.

I have a DATAGRID with columns ITEM, ITEMTYPE and a template column with a
checkbox in it called "MATCH"
Example

ITEM ITEMTYPE MATCH
Banana Fruit [ ]
Vegatable [ ]
Mineral [ ]
Sprouts Fruit [ ]
Vegatable [ ]
Mineral [ ]

If for example the user clicks the Fruit checkbox against the Banana, then
ideally I would like disable the checkbox against Vegatable and Mineral
within the banana grouping, because I do not want the user to select
multiples within the ITEM grouping.

Is this possible with I guess client side scripting? I have not done much
client side so any hints would be appreciated.

Thanks
Paul

Nov 18 '05 #2
OK Thanks Kannan that gets me started, but I actually want to manipulate
other checkboxes in different rows of the datatable, not really the one I am
currently on. So how do I reference a checkbox on another row. In asp I
would use something like

dim cb as checkbox
checkbox = datagrid1.items(1).findcontrol("CHECKBOX")

How can I do that in javascript?

hanks

"Kannan Meiappan" <mk*****@xx.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi Paul,

you can do something like this...
<asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"
Width="25px"></ItemStyle>
<ItemTemplate>
<input type="checkbox" id="chkItem" name="chkItem" runat="server" value='<%#DataBinder.Eval(Container.DataItem, "FruitId") %>' onclick="<javascript:functionfruit(this)>">
</ItemTemplate>
</asp:TemplateColumn>

Have some naming convention for your checkbox(eg: join the main and sub
category with underscore). In the javascript function pass this as
parameter. Somthing like below,

<script>
function functionfruit(obj)
{
alert(obj.id);
}
</script>

you will be having control on which checkbox you checked. based on which
you can handle your scenario.

Regards,
Kannan

"Paul" <xx@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If it's possible I would like to perform some client side actions on my
Visual Basic asp.net application. An example of what I'm trying to do.

I have a DATAGRID with columns ITEM, ITEMTYPE and a template column with a checkbox in it called "MATCH"
Example

ITEM ITEMTYPE MATCH
Banana Fruit [ ]
Vegatable [ ]
Mineral [ ]
Sprouts Fruit [ ]
Vegatable [ ]
Mineral [ ]

If for example the user clicks the Fruit checkbox against the Banana, then ideally I would like disable the checkbox against Vegatable and Mineral
within the banana grouping, because I do not want the user to select
multiples within the ITEM grouping.

Is this possible with I guess client side scripting? I have not done much client side so any hints would be appreciated.

Thanks
Paul


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matt | last post by:
I think this is the basic concept in ASP server-side development. My boss told me web application is NOT client-server application. I argued with him because browser is the client, and the server...
2
by: cedced | last post by:
Hello, is it possible to access client files in VB.NET? What? I have doing that but it isn't good (VB.NET take file on pc server and not on pc client): (thanks) Dim fichier As StreamReader ...
5
by: Ankur | last post by:
Hi Folks, I am new for this group. I want to clarify one thing what's a basic difference between Client Side Java Script and Server Side Java Script. how we can differentiate it. Why we called...
35
by: Dan Rumney | last post by:
Hi all, I've been writing Javascript for quite a while now and have, of late, been writing quite a lot of AJAX and AJAX-related code. In the main, my dynamically generated pages are created...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.