473,507 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

findcontrol in datagrid footer

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
Nov 18 '05 #1
0 1155

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1934
by: Dave | last post by:
Hi all, Does anyone know how to find a control in a DataGrid Footer by using DataGrid.FindControl etc?
1
1887
by: tshad | last post by:
I am using sample code from C# and am trying to convert it to VB.Net in my aspx page. This works in C#: DataGrid oGrid = (DataGrid)oItem.FindControl("DataGrid1"); I have tried all kinds of...
2
11170
by: MattB | last post by:
I've got some controls (mostly textboxes for now) that get created at runtime in a DataGrid. I create them using the OnItemDataBound event. I realize this isn't ideal, but I'm trying to see if I...
10
1882
by: Terry Olsen | last post by:
I've got a datagrid set up to display data. I've also got an Edit,Update,Cancel column set up to allow editing of data. I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
1
2861
by: Anup | last post by:
Hi Group, I have a datagrid with dropdown in my application. I want to fill the data in dropdown by an ArrayList for that I am using "e.Item.FindControl("DropdownId")" but this function is...
0
1249
by: David Rees | last post by:
Before I was using LoadControl and a slew of User Controls to achive the same effect, but I realised a custom TemplatedControl was the better way of doing it. Anyway, this is the templated...
11
1874
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I am trying to get the text of an item in a GridView, but am doing something wrong. Can someone help me with the correct C# statement I need? Below is my GridView and my attempt to get the control....
2
13049
by: kevin | last post by:
Hi. I'm ripping my hair out. I'm in VS 2005 Framework 2. I have one website with a gridview with some template fields. I'm using the footer row to insert records. For this discussion there is a...
1
7947
by: Andrew Robinson | last post by:
I am using the following code to preload a few controls in the FooterRow within a GridView control: protected void Page_Load(object sender, EventArgs e) {...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.