findcontrol in datagrid footer

Discussion in 'ASP .Net' started by Ruby, Jan 28, 2004.

  1. Ruby

    Ruby Guest

    Hi All...

    I have problem with web form datagrid:
    I have 1 dropdownlist and 1 text box in datagrid footer. I want every time
    index change in
    dropdown list a value from database table stored in text box
    Here some code:

    <asp:TemplateColumn SortExpression="AccNo" HeaderText="Account No">
    <ItemTemplate>
    <asp:Label id=lblAccNo runat="server" Text='<%#
    DataBinder.Eval(Container, "DataItem.AccNo") %>'>
    </asp:Label>
    </ItemTemplate>
    <FooterTemplate>
    <asp:DropDownList id="cmbAccNoIns"
    OnSelectedIndexChanged="AccNoInsIndexChange" AutoPostBack="true"
    Runat="server"></asp:DropDownList>
    </FooterTemplate>
    <EditItemTemplate>
    <asp:DropDownList id="cmbAccNo"
    OnSelectedIndexChanged="AccNoIndexChange" AutoPostBack="True"
    Runat="server"></asp:DropDownList>
    </EditItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn SortExpression="Descript" HeaderText="Description">
    <ItemTemplate>
    <asp:Label id=lblDescript runat="server" Text='<%#
    DataBinder.Eval(Container, "DataItem.Descript") %>'>
    </asp:Label>
    </ItemTemplate>
    <FooterTemplate>
    <asp:TextBox id="txtDescriptIns" Width="215px"
    Runat="server"></asp:TextBox>
    </FooterTemplate>
    <EditItemTemplate>
    <asp:TextBox id=txtDescript Width="215px" Text='<%#
    DataBinder.Eval(Container, "DataItem.Descript") %>' Runat="server">
    </asp:TextBox>
    </EditItemTemplate>
    </asp:TemplateColumn>

    in codebehind:

    Public Sub AccNoInsIndexChange(ByVal sender As Object, ByVal e As EventArgs)

    Dim txtDescriptIns As TextBox = CType(FindControl("txtDescriptIns"),
    TextBox) // Not found



    Dim s As String = cmbDivision.SelectedValue + CType(sender,
    DropDownList).SelectedValue

    Dim dbAccess As New Pratama.AllClass

    Dim sAccDesc(1) As String

    sAccDesc = dbAccess.GetColumnSingleValue("Select MA_AccDesc From MST_COA
    Where MA_Division+MA_AccNo = '" + s + "'")

    txtDescriptIns.Text = sAccDesc(1) // Error since txtdescriptIns is Nothing

    End Sub

    why findcontrol method doesn't return any object? or is there any other trik
    to to that?



    Thank



    Ruby
     
    Ruby, Jan 28, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave

    Datagrid FindControl in Footer

    Dave, Nov 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,118
  2. Replies:
    2
    Views:
    3,140
    KevD711
    Apr 26, 2007
  3. Andrew Robinson

    FindControl in GridView Footer

    Andrew Robinson, Apr 24, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    1,036
    Andrew Robinson
    Apr 25, 2007
  4. Henrik
    Replies:
    1
    Views:
    465
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
  5. Replies:
    0
    Views:
    180
Loading...

Share This Page