|
I have a single row datagrid for adding records. I populate the grid dynamically with dynamic item templates because I have custom controls in the grid.
My ddl is a list of years. When a year is selected, I want to populate a textbox in the grid.
Problem: the entire grid disappears when I select a year
Code:
Public Class DynamicItemTemplate_DropDownList_Year
Implements ITemplate
Public Overridable Overloads Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn
Dim oDropDownList As DropDownList = New DropDownList
oDropDownList.AutoPostBack = True
oDropDownList.EnableViewState = False
AddHandler oDropDownList.Init, AddressOf BindDropDownList
AddHandler oDropDownList.SelectedIndexChanged, AddressOf ChangedDropDownList
container.Controls.Add(oDropDownList)
End Sub
Public Sub BindDropDownList(ByVal sender As Object, ByVal e As EventArgs)
Dim oDropDownList As DropDownList = CType(sender, DropDownList)
Dim container As DataGridItem = CType(oDropDownList.NamingContainer, DataGridItem)
Dim i As Integer
For i = 0 To 5
oDropDownList.Items.Add(New ListItem(CStr(CInt(Now.Year) + 5 - i), CStr(CInt(Now.Year) + 5 - i)))
Next
oDropDownList.SelectedValue = m_SelectedYear
End Sub
Public Sub ChangedDropDownList(ByVal sender As Object, ByVal e As EventArgs)
Dim oDropDownList As DropDownList = CType(sender, DropDownList)
Dim container As DataGridItem = CType(oDropDownList.NamingContainer, DataGridItem)
Dim oDescription As TextBox = CType(container.Cells(4).Controls(0), TextBox)
oDescription.Text = oDropDownList.SelectedItem.Text
End Sub
End Class
|
|
|
|
|
I have a strongly typed dataset (STD). I do a fill using the table adapter and the assoc. datatables are all fine and well. My questions involve how to best use the datarow (the strongly typed version- IE: dtTableName.TableNameRow).
Simple example below, just trying to illustrate my question.
I am creating a dsLabelFormats.dtFRCRow and then setting its value further down in code using a Directcast. The Directcast works, but is there a diff. method to do this without using a cast or a more efficient way of doing it? My code isn't doing a for each loop, I'm justing processing specific indexes.
Dim dr As dsLabelFormats.dtFRCRow = Nothing
_taFRC.Fill(_dsLabelFormats.dtFRC, vlngSerial, 1)
'Do some processing here and come up with specific records I want to process.
'Can this be done without a cast since I have a specific index on a STD.datatable?
dr = DirectCast(_dsLabelFormats.dtFRC.Rows(iIndex), dsLabelFormats.dtFRCRow)
With dr
'Set other variables here...
End With
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
The _dsLabelFormats.dtFRC.Rows(iIndex) is already of type dsLabelFormats.dtFRCRow therefore there should be no need to Cast it only assign it as follows :-
dr = _dsLabelFormats.dtFRC.Rows(iIndex)
So, in answer to the question is your code comment
Jon_Boy wrote: 'Can this be done without a cast since I have a specific index on a STD.datatable?
Yes
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I have Option Strict turned on so the following line doesn't work without a cast (because it's an implicit conversion). Is there another way to accomplish this without a cast? It's not a huge deal, just thought there might be a method or another way of doing it that I am not aware of.
dr = _dsLabelFormats.dtFRC.Rows(iIndex)
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
modified on Thursday, January 22, 2009 7:19 AM
|
|
|
|
|
In that case, no, you will have to cast.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
i have to convert insert statement in vb using msaccess to oracle...
earlier iam using val...now for oracle what i have to use...
|
|
|
|
|
This question should go in the database forum, you will get better help there.
|
|
|
|
|
That would be TO_NUMBER .
As mentioned, this would propably belong to General Database forum.
|
|
|
|
|
i developed one project in vb.net i want to publish that project... i can't add my database during publish ....
|
|
|
|
|
If you are using a local file as a database like access, use relative paths and put it in the application directory. If you are using a database connected to the internet, stay away from using local IPS or LAN addresses.
|
|
|
|
|
|
It depends on what kind of database engine you're going to use. Compact Edition, Express Edition etc.
|
|
|
|
|
How get the full height of a window that has attached to a vertical scrollbar?
|
|
|
|
|
If you're talking about the client area of a form, there is no propery for it. Off the top of my head, you could put a Panel control on the form, making it as large as you want or dynamic as you want, then get the height of that instead.
|
|
|
|
|
|
That changes the question quite a bit.
So, how is your application supposed to know which window is the correct one that represents the client area?? Hint: There is no function you can call to tell you this!
|
|
|
|
|
no dave,
i use to get window from point. then i check weather this window has a scroll bar. then i realize that this window is higher than the visible width and height.
now my qustion is, how to retrive the full width and height effeciently.
|
|
|
|
|
Dave Kreskowiak wrote: If you're talking about the client area of a form, there is no propery for it
Actually there is:
Me.ClientSize
Never used it tho so don't know how accurate it is.
|
|
|
|
|
You know, I've never used it either, and have totally forgotten that it was even there!
|
|
|
|
|
hi experts,
i did one project in vb.net with database connection..... don't know how to publish that project... send me the procedure...
|
|
|
|
|
I will do it tomorrow. I am going golfing today.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
|
Nice initial post.
|
|
|
|
|
I'm sorry, I didn't see you wanted an urgent reply. Is this quick enough?
What you actually need is a lesson in manners. The people who answer questions on code project do so in their own time, for free, and do not respond well to demands from people too damned lazy to do their own research on what is a simple enough problem.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
****Urgent reply****
Go pound salt.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|