Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > datagrid - dropdownlist - checkbox problem

Reply
Thread Tools

datagrid - dropdownlist - checkbox problem

 
 
buran
Guest
Posts: n/a
 
      04-17-2004
Dear ASP.NET Programmers,

I have the following problem. I have a datagrid (ID: grdAllActions). This
datagrid has two template columns: one column with the dropdownlist control
(ID: ddlPS) and another with a checkbox control (ID: cbPS). My goal is to
enable or disable the dropdownlist control when the user checks or unchecks
the checkbox. I am trying the following code:

<asp:TemplateColumn HeaderText="Payment Status">
<ItemTemplate>
<aspropDownList ID="ddlPS" AutoPostBack="True" runat="server"
OnSelectedIndexChanged="GetSelectedIndex">
<asp:ListItem Selected="true">Awaiting Invoice</asp:ListItem>
<asp:ListItem>Invoice Received</asp:ListItem>
<asp:ListItem>No Invoice (make payment)</asp:ListItem>
<asp:ListItem>Prepayment made (awating invoice)</asp:ListItem>
</aspropDownList>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="cbPS" Runat="server" AutoPostBack="True"
OnCheckedChanged="DisablePS"></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>

Sub DisablePS(ByVal sender As Object, ByVal e As EventArgs)
Dim cb As CheckBox
cb = CType(sender, CheckBox)
If cb.Checked = True Then
'?????????
End If
End Sub

How can I get the index of the row that contins the checkbox? Thanks in
advance,

Burak Kadirbeyoglu


 
Reply With Quote
 
 
 
 
Jos
Guest
Posts: n/a
 
      04-17-2004
"buran" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dear ASP.NET Programmers,
>
> I have the following problem. I have a datagrid (ID: grdAllActions). This
> datagrid has two template columns: one column with the dropdownlist

control
> (ID: ddlPS) and another with a checkbox control (ID: cbPS). My goal is to
> enable or disable the dropdownlist control when the user checks or

unchecks
> the checkbox. I am trying the following code:
>
> <asp:TemplateColumn HeaderText="Payment Status">
> <ItemTemplate>
> <aspropDownList ID="ddlPS" AutoPostBack="True"

runat="server"
> OnSelectedIndexChanged="GetSelectedIndex">
> <asp:ListItem Selected="true">Awaiting

Invoice</asp:ListItem>
> <asp:ListItem>Invoice Received</asp:ListItem>
> <asp:ListItem>No Invoice (make payment)</asp:ListItem>
> <asp:ListItem>Prepayment made (awating

invoice)</asp:ListItem>
> </aspropDownList>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:CheckBox ID="cbPS" Runat="server" AutoPostBack="True"
> OnCheckedChanged="DisablePS"></asp:CheckBox>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> Sub DisablePS(ByVal sender As Object, ByVal e As EventArgs)
> Dim cb As CheckBox
> cb = CType(sender, CheckBox)
> If cb.Checked = True Then
> '?????????
> End If
> End Sub
>
> How can I get the index of the row that contins the checkbox? Thanks in
> advance,
>
> Burak Kadirbeyoglu


Something like:

Dim item As DataGridItem = CType(cb.Parent,DataGridItem)
Dim row As Integer = item.ItemIndex

--

Jos


 
Reply With Quote
 
 
 
 
buran
Guest
Posts: n/a
 
      04-17-2004
Thanks Jos,

That was exactly what I've been looking for (The only change is: cb.Parent
to cb.Parent.Parent)

Dim item As DataGridItem = CType(cb.Parent.Parent, DataGridItem)
Dim row As Integer = item.ItemIndex

Burak Kadirbeyoglu

"Jos" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "buran" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Dear ASP.NET Programmers,
> >
> > I have the following problem. I have a datagrid (ID: grdAllActions).

This
> > datagrid has two template columns: one column with the dropdownlist

> control
> > (ID: ddlPS) and another with a checkbox control (ID: cbPS). My goal is

to
> > enable or disable the dropdownlist control when the user checks or

> unchecks
> > the checkbox. I am trying the following code:
> >
> > <asp:TemplateColumn HeaderText="Payment Status">
> > <ItemTemplate>
> > <aspropDownList ID="ddlPS" AutoPostBack="True"

> runat="server"
> > OnSelectedIndexChanged="GetSelectedIndex">
> > <asp:ListItem Selected="true">Awaiting

> Invoice</asp:ListItem>
> > <asp:ListItem>Invoice Received</asp:ListItem>
> > <asp:ListItem>No Invoice (make payment)</asp:ListItem>
> > <asp:ListItem>Prepayment made (awating

> invoice)</asp:ListItem>
> > </aspropDownList>
> > </ItemTemplate>
> > </asp:TemplateColumn>
> > <asp:TemplateColumn>
> > <ItemTemplate>
> > <asp:CheckBox ID="cbPS" Runat="server" AutoPostBack="True"
> > OnCheckedChanged="DisablePS"></asp:CheckBox>
> > </ItemTemplate>
> > </asp:TemplateColumn>
> >
> > Sub DisablePS(ByVal sender As Object, ByVal e As EventArgs)
> > Dim cb As CheckBox
> > cb = CType(sender, CheckBox)
> > If cb.Checked = True Then
> > '?????????
> > End If
> > End Sub
> >
> > How can I get the index of the row that contins the checkbox? Thanks in
> > advance,
> >
> > Burak Kadirbeyoglu

>
> Something like:
>
> Dim item As DataGridItem = CType(cb.Parent,DataGridItem)
> Dim row As Integer = item.ItemIndex
>
> --
>
> Jos
>
>



 
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
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked. Joey Pang ASP .Net Datagrid Control 4 06-13-2005 02:29 AM
Problem with DataGrid, CheckBox and DropDownList shiv ASP .Net Web Controls 0 06-17-2004 09:00 PM
datagrid - dropdownlist - checkbox problem buran ASP .Net 2 04-17-2004 11:17 AM
Added CheckBox to a DataGrid Doesn't work with DataGrid.Enabled=False Amar ASP .Net 0 04-06-2004 10:14 AM



Advertisments