473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to access control in template datagrid

Hi I need to change the text value of a dropdown list box that is in a
template column of a data grid but was not sure how to access it, probably
something like
datagrid1.control.dropdownlist.text = "" but not sure.
--
Paul G
Software engineer.
Nov 18 '05 #1
5 5112
Hi Shailesh, thanks for the response. I set up the following in the
ItemDataBound event and set a breakpoint but has nothing in s_temp.
here is the control id <asp:dropdownlist id=dr_lst_dest
in the ItemDataBound event for the grid I have
Dim s_temp As Object
s_temp = e.Item.FindControl("dr_lst_dest")'breakpt here
End Sub
Also I need to read the selected value when someone makes a selection
probably in the
DataGrid1_SelectedIndexChanged event, was not sure if you have done that
before.

"Shailesh Jannu" wrote:
Handle the ItemDataBound event
and in the event find the control using e.Item.FindControl(controlID)
and then when u get the control change the text of the control..
"Paul" wrote:
Hi I need to change the text value of a dropdown list box that is in a
template column of a data grid but was not sure how to access it, probably
something like
datagrid1.control.dropdownlist.text = "" but not sure.
--
Paul G
Software engineer.

Nov 18 '05 #2
Just a bit more information. looks like the ItemDataBound event fires 3
times, and after the second time looks like it does find the contol. I have
several column with the datagrid binded to a data set and then 3 columns with
dropdown list boxes with each data binding to a dataset.

"Paul" wrote:
Hi Shailesh, thanks for the response. I set up the following in the
ItemDataBound event and set a breakpoint but has nothing in s_temp.
here is the control id <asp:dropdownlist id=dr_lst_dest
in the ItemDataBound event for the grid I have
Dim s_temp As Object
s_temp = e.Item.FindControl("dr_lst_dest")'breakpt here
End Sub
Also I need to read the selected value when someone makes a selection
probably in the
DataGrid1_SelectedIndexChanged event, was not sure if you have done that
before.

"Shailesh Jannu" wrote:
Handle the ItemDataBound event
and in the event find the control using e.Item.FindControl(controlID)
and then when u get the control change the text of the control..
"Paul" wrote:
Hi I need to change the text value of a dropdown list box that is in a
template column of a data grid but was not sure how to access it, probably
something like
datagrid1.control.dropdownlist.text = "" but not sure.
--
Paul G
Software engineer.

Nov 18 '05 #3
Hi Paul
The itemdatabound event will fire for each row..including header and footer
So you will have to check e.Item.ItemSyle and find that control when the
itemstyle is item or alternatingitem..
check this example
http://datawebcontrols.com/faqs/Prog...ts.print.shtml

Hope this helps
"Paul" wrote:
Just a bit more information. looks like the ItemDataBound event fires 3
times, and after the second time looks like it does find the contol. I have
several column with the datagrid binded to a data set and then 3 columns with
dropdown list boxes with each data binding to a dataset.

"Paul" wrote:
Hi Shailesh, thanks for the response. I set up the following in the
ItemDataBound event and set a breakpoint but has nothing in s_temp.
here is the control id <asp:dropdownlist id=dr_lst_dest
in the ItemDataBound event for the grid I have
Dim s_temp As Object
s_temp = e.Item.FindControl("dr_lst_dest")'breakpt here
End Sub
Also I need to read the selected value when someone makes a selection
probably in the
DataGrid1_SelectedIndexChanged event, was not sure if you have done that
before.

"Shailesh Jannu" wrote:
Handle the ItemDataBound event
and in the event find the control using e.Item.FindControl(controlID)
and then when u get the control change the text of the control..
"Paul" wrote:

> Hi I need to change the text value of a dropdown list box that is in a
> template column of a data grid but was not sure how to access it, probably
> something like
> datagrid1.control.dropdownlist.text = "" but not sure.
> --
> Paul G
> Software engineer.

Nov 18 '05 #4
check this as well

http://www.dotnetjunkies.com/Tutoria...3188A91F7.dcik

"Paul" wrote:
Just a bit more information. looks like the ItemDataBound event fires 3
times, and after the second time looks like it does find the contol. I have
several column with the datagrid binded to a data set and then 3 columns with
dropdown list boxes with each data binding to a dataset.

"Paul" wrote:
Hi Shailesh, thanks for the response. I set up the following in the
ItemDataBound event and set a breakpoint but has nothing in s_temp.
here is the control id <asp:dropdownlist id=dr_lst_dest
in the ItemDataBound event for the grid I have
Dim s_temp As Object
s_temp = e.Item.FindControl("dr_lst_dest")'breakpt here
End Sub
Also I need to read the selected value when someone makes a selection
probably in the
DataGrid1_SelectedIndexChanged event, was not sure if you have done that
before.

"Shailesh Jannu" wrote:
Handle the ItemDataBound event
and in the event find the control using e.Item.FindControl(controlID)
and then when u get the control change the text of the control..
"Paul" wrote:

> Hi I need to change the text value of a dropdown list box that is in a
> template column of a data grid but was not sure how to access it, probably
> something like
> datagrid1.control.dropdownlist.text = "" but not sure.
> --
> Paul G
> Software engineer.

Nov 18 '05 #5
ok thanks for the help, the example looks pretty good.

"Shailesh Jannu" wrote:
Hi Paul
The itemdatabound event will fire for each row..including header and footer
So you will have to check e.Item.ItemSyle and find that control when the
itemstyle is item or alternatingitem..
check this example
http://datawebcontrols.com/faqs/Prog...ts.print.shtml

Hope this helps
"Paul" wrote:
Just a bit more information. looks like the ItemDataBound event fires 3
times, and after the second time looks like it does find the contol. I have
several column with the datagrid binded to a data set and then 3 columns with
dropdown list boxes with each data binding to a dataset.

"Paul" wrote:
Hi Shailesh, thanks for the response. I set up the following in the
ItemDataBound event and set a breakpoint but has nothing in s_temp.
here is the control id <asp:dropdownlist id=dr_lst_dest
in the ItemDataBound event for the grid I have
Dim s_temp As Object
s_temp = e.Item.FindControl("dr_lst_dest")'breakpt here
End Sub
Also I need to read the selected value when someone makes a selection
probably in the
DataGrid1_SelectedIndexChanged event, was not sure if you have done that
before.

"Shailesh Jannu" wrote:

> Handle the ItemDataBound event
> and in the event find the control using e.Item.FindControl(controlID)
> and then when u get the control change the text of the control..
>
>
> "Paul" wrote:
>
> > Hi I need to change the text value of a dropdown list box that is in a
> > template column of a data grid but was not sure how to access it, probably
> > something like
> > datagrid1.control.dropdownlist.text = "" but not sure.
> > --
> > Paul G
> > Software engineer.

Nov 18 '05 #6

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

Similar topics

0
by: Andy Eshtry | last post by:
Hello Dear Professionals: Based on this document: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatingwebservercontroltemplatesdynamically.asp or this...
0
by: bill yeager | last post by:
I have a datalist displaying parent information and a datagrid presenting child information. The data is being rendered just fine. The datagrid has template columns on it that I cannot gain access...
1
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As...
2
by: Dimitris Pantazopoulos | last post by:
Hello. I am trying to do the simplest of things. These are exactly the steps I follow: 1. create an sqlConnection to an SQL Server database. 2. create a DataSource and produce a DataSet to a...
0
by: Earl Teigrob | last post by:
I have created a templated custom control that simply creates a spacing table around other objects. This control works fine for most uses but when I add it inside the ItemTemplate of a DataGrid...
6
by: Tim Meagher | last post by:
Can anyone help me figure out how to apply a stylesheet to a pushbutton defined in the asp:BoundColumn or asp:EditCommandColumn elements of a datagrid?
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
1
by: Raghuram | last post by:
Hi, i have a DataGrid by Name : datagrid1 and in that i had created one templete Column and Added a new datagrid : datagrid2. Now i want to access that datagrid2 how is it possiable. and populate...
1
by: JV | last post by:
I thought I'd done it all with DataGrids, but I hit a situation I haven't seen anyone cope with. This might make a great article. The problem with the template columns in a datagrid is that the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.