|
It's doing nothing. It assigns the right values to the name labels which it pulls from database but nothing to the buttons.
I could assign the value via:
<%# 'Text=Eval(data)' %>
but I still will have to loop through the buttons as they need to send different values to the session object as clicked which are needed on the next site to which they redirect.
Otherwise I would have to create every time a LinkButton_onClicked handler for each button.
(FYI: I just started coding with .net 2 weeks ago)
|
|
|
|
|
TAK78 wrote: (FYI: I just started coding with .net 2 weeks ago)
I"m assuming you had extensive coding experience before this then ?
What happens if you check the value of the text on the button after you assign it ? I'm wondering if CType makes a copy ? I don't know, I'm just guessing.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Used to code in ActionScript for about 3 years, but still have trouble with syntax in .NET.
Well actual code needs to be:
text='<%# Eval("data") %>' //sorry for that
Here is the code to check if any value was assigned to the button:
For i As Integer = 0 To DataList1.Items.Count - 1
Dim linktext As String
linktext = (CType(Me.DataList1.Items(i).FindControl("materialLabel"), Label).Text)
CType(Me.DataList1.Items(i).FindControl("LinkButton"), LinkButton).Text = linktext
Dim buttonString As String
buttonString = CType(Me.DataList1.Items(i).FindControl("LinkButton"), LinkButton).Text
txtLabel.Text = buttonString
Next
It will display the value of the last button in txtLabel, which would mean that it got assigned the value, but why want it display than?
|
|
|
|
|
If you step through the debugger then I would assume you're going to see the same result. That is what you should do to check, however.
Where is the data coming from ? Where is this code called ? Is it possible that you rebind to your data source after this code runs ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The data is pulled from the database. Which makes its selection for the row through the variable data it gets from the session:
Session("data") = "B" 'selects all "B" like rows in database
Works fine on my material label as I use:
<asp:Label ID="materialLabel" runat="server" text='<%# Eval("material") %>'></asp:Label>
The code for the buttons however is called on the Page_Load, where I use the loop.
I will need a loop for the buttons because I need to assign a new Session value for each one after they are pressed, as they will redirect to a new page which will display the information of the selected material.
And it wouldn't be efficient to create a LinkButton_Click handler for each one, as some pages may have 10 or more buttons.
I also checked now in Debug and the buttons actually get assigned the right value, but it want display on the buttons on the site.
If you know another or better solution let me know.
Thanks for your efforts by the way!
-- modified at 21:31 Tuesday 10th April, 2007
|
|
|
|
|
TAK78 wrote: The data is pulled from the database.
Where ?
TAK78 wrote: The code for the buttons however is called on the Page_Load, where I use the loop.
OK, if you read from the DB in page prerender or an event, then that code will run after and replace your data.
TAK78 wrote: I will need a loop for the buttons because I need to assign a new Session value for each one after they are pressed,
Why do you need to use session state at all ?
TAK78 wrote: And it wouldn't be efficient to create a LinkButton_Click handler for each one, as some pages may have 10 or more buttons.
You should create one click event handler and have it check which button has been pressed, not create an event for each button.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am looking to create a program where you can schedule a persons time by jobs. These jobs may take 1 hour to 10 hours. I would like to be able to use it like a gantt chart where I have a list of jobs and I can add them to each persons timeline.
OR If someone could point me in the direction of how to do this I would be most appreciative.
Thanks for all the help
NewbieDave
|
|
|
|
|
If you may remember I had created a HTA that unlocks computers on our network. The HTA works great. No issues from any of the department managers that use it. It drives me crazy though. I don't think it's clean enough. to be able to use it I have to put the HTA and several batch files and several script files on the machine in a folder. Is it possible to convert the HTA, batch, and script files into a program that I could run an installer with and possibly an updater? Not only would it make the whole project cleaner, but it would add security to the program since it would keep the code out of reach.
So back to the question, is it possible?
Zach
|
|
|
|
|
I will try to answer your question this way:
Do I know of a converter to switch from VBScript to VB.NET? No.
Can the code be rewritten an a VB.NET service? I don't see why not.
I have written a number of services in VB.NET to accomplish various tasks; some have been in production for a couple of years.
Tim
|
|
|
|
|
Thanks. Atleast I know it's possible. Now I can start trying to convert the scripts into a single program. Thanks again.
Zach
|
|
|
|
|
Hello all,
This is probably a simple issue but since I am a newbie I am really stuck on it. I have been developing some code (VB.Net 2005) and I was using rowPosition to pull data from an Access Data base and I changed it to something that will read through and match up my primary keys (MR#). Anyway this works fine as long as I have data in every field in the table. But if/when it finds a field that is blank (Null) I get this error “The value for column 'SurgType' in table 'Pat01Surgery' is DBNull.”
This is the code I was using before….
'If dtSurgery.Rows(rowPositionSurg)("SurgType") Is DBNull.Value Then
' rdbtnInpatient.Checked = False
' rdbtnOutpatient.Checked = False
'ElseIf dtSurgery.Rows(rowPositionSurg)("SurgType")= "I" Then
' rdbtnInpatient.Checked = True
'ElseIf dtSurgery.Rows(rowPositionSurg)("SurgType") = "O" Then
' rdbtnOutpatient.Checked = True
'End If
Now I am trying to use this code....
'If ShowSurg.SurgType Is DBNull.Value Then
'If IsDBNull(ShowSurg.SurgType) Then
If ShowSurg.SurgType Is String.Empty Then
rdbtnInpatient.Checked = False
rdbtnOutpatient.Checked = False
ElseIf ShowSurg.SurgType = "I" Then
rdbtnInpatient.Checked = True
ElseIf ShowSurg.SurgType = "O" Then
rdbtnOutpatient.Checked = True
End If
This code used to work fine before I had to change it. Now I can’t seem to get the snytax right or something. As can tell I have tried several different ways to look for null. But it still kicks out that error.
Can anyone give me some advice on how this should be entered? I am still learning so you may have to dummy it down for me. Thanks in advance for any help you can give.
|
|
|
|
|
You can check for NULL values as follows:
<br />
If dtSurgery.Rows(rowPositionSurg).IsNull("SurgType") Then<br />
|
|
|
|
|
Thanks! I couldn't use exactly what you suggested (because that is what I was doing before) but it did open my eyes to see the answer. This is what I am using now and it seems to work just fine....
If ShowSurg.IsNull("SurgType") Then
Thanks again!
|
|
|
|
|
i have linked the wireless to the hyperterminal of the windows...
data is comin to hyperterminal...
now i want to store that hyperterminal dta in backend through front end....
but finding problem in storing data in back end..
any help..???
thanks
|
|
|
|
|
I have a form with a tab control with several tabs. The main tab has many controls on it. The app is performing various "tests" and displaying pass/fail in the main tab. One of the tests is a communication test. It sends out a message and expects an asynchronous reply within a certain timeout.
When I click on a tab and then go back to the main tab, it takes almost a second for all the controls to be repainted. This causes the CPU to peg at 100% usage and will occasionally cause my communication test to timeout (the timer expires before the reply is received).
Does anyone have any ideas to get around this problem? I have already increased the timeout period as much as I want to. I also do not want to disable the test when I switch tabs.
Thanks
VF
|
|
|
|
|
Just brainstorming but I would think about threading the UI and try to get a lazier load if possible.
Here are the articles I have used
|
|
|
|
|
|
You were correct! I was doing everything inside the UI thread. I redesigned the app to use threads for each of my tests. Now the test never fails, even when the CPU is maxed at 100%!!!
|
|
|
|
|
Great to hear did you get a chance to work with the background worker object or did you write your own threading class?
|
|
|
|
|
I am building an application which will run on PocketPC (2003 SE and Mobile 5.0) Devices (barcode scanners) located in different companies who will use my application.
As part of the application, the application will connect to a webservice (which I am also writing) running at the company location (ie, each company has their own IIS WebService).
I am aware of the Dynamic URL setting. Not a problem. However, everything that I am reading talks about establishing the configuration prior to distribution.
The Problem: Each Company will logically setup their web services with a different URL: ie, http://192.168.0.4/webservicename , http://companymachine/webservicename ). In looking for this answer, I have not come up with any discussion about the ability or sample code.
I am looking for VB.NET code which will permit administration to either enter the webservice URL on the PocketPC device or code which will pull in the WebService URL from a file (TXT or XML) on the Pocket PC device.
The thought is if the PocketPC Application can read the URL values from a file, then the PocketPC Application can be distributed globally to different companies and each company is then in the position to provide their unique URL. The alternative is to maintain builds for each company location which would be an insanely inefficient approach.
Michael
|
|
|
|
|
friend try this out
there is a file reference.vb under the webreference > reference.map
there you can give URL of the webservice dynamicaly
Namespace Service1
Public Class Service
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
'<remarks>
Public Sub New()
MyBase.New()
Me.Url = "http://" & functionThatReadURLFromTextFile() & "/WebServicesName/Service1.asmx"
End Sub
End Class
End Namespace
Milan
|
|
|
|
|
Sir/madam,
I want to convert the adate in the following format
dd/mm/yyyy hh:mm tt
how should i do that
Thanks and Regards
Pankaj Garg
|
|
|
|
|
Hi,
try the following
<br />
MsgBox(Now.ToString("dd/MM/yyyy hh:mm tt"))<br />
Mubashir
Every job is a self portrait of the person who did it.
|
|
|
|
|
try this coding
dim yourstring as string
yourstring = datetime.now
textbox1.text=yourstring
u'll get date n time in required format
|
|
|
|
|