Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Client side scripting with asp datagrid

Reply
Thread Tools

Client side scripting with asp datagrid

 
 
Paul
Guest
Posts: n/a
 
      10-12-2004
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




 
Reply With Quote
 
 
 
 
Kannan Meiappan
Guest
Posts: n/a
 
      10-12-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>
>
>



 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      10-12-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > 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
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Hide Datagrid Column via client side scripting (Javascript) Rob ASP .Net 7 12-07-2005 03:06 AM
ASP:HyperLink control and client-side scripting Brian W ASP .Net 4 03-04-2004 05:24 PM
Client side scripting with ASP.net server controls e ASP .Net 2 11-21-2003 09:49 PM
Client side and server side scripting problem Kathryn ASP General 9 10-17-2003 07:25 PM



Advertisments