Professional Web Applications Themes

datagrid - dropdownlist - checkbox problem - ASP.NET Data Grid Control

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 ...

  1. #1

    Default 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


    buran Guest

  2. #2

    Default Re: datagrid - dropdownlist - checkbox problem

    "buran" <buranburan.com> wrote in message
    news:O9kTAKGJEHA.600TK2MSFTNGP09.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


    Jos Guest

  3. #3

    Default 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" <josnospambrandersfastmail.fm> wrote in message
    news:O8cq1mGJEHA.3500TK2MSFTNGP10.phx.gbl...
    > "buran" <buranburan.com> wrote in message
    > news:O9kTAKGJEHA.600TK2MSFTNGP09.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 Guest

Similar Threads

  1. datagrid - checkbox cellrenderer - problem
    By grzechuu in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: October 1st, 06:26 AM
  2. Checkbox in DataGrid Problem
    By grzechuu in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 31st, 07:19 AM
  3. problem accessing checkbox in datagrid
    By shalin in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: March 3rd, 02:38 PM
  4. CheckBox inside DataGrid problem
    By popobawa61 in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: October 2nd, 08:25 PM
  5. checkbox column in a datagrid problem
    By Eric in forum ASP.NET
    Replies: 2
    Last Post: July 16th, 08:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139