Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   datagrid - dropdownlist - checkbox problem (http://www.velocityreviews.com/forums/t760462-datagrid-dropdownlist-checkbox-problem.html)

buran 04-17-2004 09:57 AM

datagrid - dropdownlist - checkbox problem
 
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>
<asp:DropDownList 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>
</asp:DropDownList>
</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



Jos 04-17-2004 10:51 AM

Re: datagrid - dropdownlist - checkbox problem
 
"buran" <buran@buran.com> wrote in message
news:O9kTAKGJEHA.600@TK2MSFTNGP09.phx.gbl...
> 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>
> <asp:DropDownList 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>
> </asp:DropDownList>
> </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



buran 04-17-2004 11:17 AM

Re: datagrid - dropdownlist - checkbox problem
 
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" <josnospambranders@fastmail.fm> wrote in message
news:O8cq1mGJEHA.3500@TK2MSFTNGP10.phx.gbl...
> "buran" <buran@buran.com> wrote in message
> news:O9kTAKGJEHA.600@TK2MSFTNGP09.phx.gbl...
> > 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>
> > <asp:DropDownList 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>
> > </asp:DropDownList>
> > </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
>
>





All times are GMT. The time now is 03:43 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57