Thursday, March 29, 2012
Pop Up?
error message in a dialog box.
But I found it only works with IE, Not Netscape.
Did someone have it work ever?
Thanks.Hi,
Validations got server and client side validation. When you browse your
pages in Netscape they use the server-side validation and not the
client-side validation as the client side Validation scripts only works
only with IE.
Natty Gur[MVP]
blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Saturday, March 24, 2012
Populate Month in Combobox <Resolved>
I have a asp.net control combo box. I want to pouplate it with the name of the months.
I am wring the code in the code behind. I am using vb.net as the code behind.
My code is
'Month
dim i as integer
dim myvar as string
i = 1
Do While i <= 12
myvar = MonthName(i, True)
cboMonth.Items.Add(myvar)
i = i + 1
Loop
I get the populated month names in the combobox, because of the function month name.
But in the value I want 1,2,3 not Jan, Feb, Mar...How to achive this.
Had been it ASP I wud have written:
do while iLoop <= 12
myvar = MonthName(iLoop,true)
Response.Write "<option value=" & iLoop & " selected>" & myvar & "</option>"
iLoop = i Loop+1
loop
This wud have given me the dsired result.
How to do in VB.NET?With a bit of R&D got the solution:
i = 1
Do While i <= 12
myvar = MonthName(i, True)
cboToMonth.Items.Add(New ListItem(myvar, i))
i = i + 1
Loop
populate public property from a function
values generated by the control.
When I assign the value of the property to a function in the control, which
creates the values, I get a compilation error that says
the function doesn't have all the other property values to work with.
So, how do I populate the arraylist as a public property, so I can use it in
my web page ?
========== code in use ==========
I create the property wth the webpage by:
............
Dim arrTempList As New ArrayList()
oThis.myArrayList = arrTempList
...........
I have the the property defined in the control as:
...............
Public arrChartList As Arraylist
Public Property myArrayList As ArrayList
Get
Return arrChartList
End Get
Set
arrChartList = myfunction() '<--builds values for arraylist
End Set
End Property
.................Where is 'myfunction' declared? This looks like a scoping issue.
I am also

ignore the argument and just call a function. Why bother having a Set on the
property to begin with? People are going to be setting the property to
something - but that something will be complete ignored? Very confusing.
"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>I have a public property in my server control and I want to populate it
>with values generated by the control.
> When I assign the value of the property to a function in the control,
> which creates the values, I get a compilation error that says the function
> doesn't have all the other property values to work with.
> So, how do I populate the arraylist as a public property, so I can use it
> in my web page ?
>
> ========== code in use ==========
> I create the property wth the webpage by:
> ............
> Dim arrTempList As New ArrayList()
> oThis.myArrayList = arrTempList
> ...........
>
> I have the the property defined in the control as:
> ...............
> Public arrChartList As Arraylist
> Public Property myArrayList As ArrayList
> Get
> Return arrChartList
> End Get
> Set
> arrChartList = myfunction() '<--builds values for arraylist
> End Set
> End Property
> .................
>
>
"myfunction" is in the control.
Yes, I am totally

what should I be doing ?
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:%236og2UHSGHA.4440@.TK2MSFTNGP11.
phx.gbl...
> Where is 'myfunction' declared? This looks like a scoping issue.
> I am also

ore the argument and just call a function. Why bother
> having a Set on the property to begin with? People are going to be setting
the property to something - but that something will be
> complete ignored? Very confusing.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:
evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>
That depends on what you are trying to do in the first place. You either
want the user to assign a value to the property or you don't and want to
assign the variable a value returned by a function instead.
"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
> "myfunction" is in the control.
> Yes, I am totally

> what should I be doing ?
>
>
> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message
> news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
>
I want the property to have the value created by the function.
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:uW8uI$PSGHA.1780@.TK2MSFTNGP12.ph
x.gbl...
> That depends on what you are trying to do in the first place. You either w
ant the user to assign a value to the property or you
> don't and want to assign the variable a value returned by a function inste
ad.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:
%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
>
populate public property from a function
When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that says
the function doesn't have all the other property values to work with.
So, how do I populate the arraylist as a public property, so I can use it in my web page ?
========== code in use ==========
I create the property wth the webpage by:
............
Dim arrTempList As New ArrayList()
oThis.myArrayList = arrTempList
............
I have the the property defined in the control as:
................
Public arrChartList As Arraylist
Public Property myArrayList As ArrayList
Get
Return arrChartList
End Get
Set
arrChartList = myfunction() '<--builds values for arraylist
End Set
End Property
..................Where is 'myfunction' declared? This looks like a scoping issue.
I am also confused why in the Set for a property, you would completely
ignore the argument and just call a function. Why bother having a Set on the
property to begin with? People are going to be setting the property to
something - but that something will be complete ignored? Very confusing.
"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>I have a public property in my server control and I want to populate it
>with values generated by the control.
> When I assign the value of the property to a function in the control,
> which creates the values, I get a compilation error that says the function
> doesn't have all the other property values to work with.
> So, how do I populate the arraylist as a public property, so I can use it
> in my web page ?
>
> ========== code in use ==========
> I create the property wth the webpage by:
> ............
> Dim arrTempList As New ArrayList()
> oThis.myArrayList = arrTempList
> ...........
>
> I have the the property defined in the control as:
> ...............
> Public arrChartList As Arraylist
> Public Property myArrayList As ArrayList
> Get
> Return arrChartList
> End Get
> Set
> arrChartList = myfunction() '<--builds values for arraylist
> End Set
> End Property
> .................
"myfunction" is in the control.
Yes, I am totally confused on this and really need help.
what should I be doing ?
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
> Where is 'myfunction' declared? This looks like a scoping issue.
> I am also confused why in the Set for a property, you would completely ignore the argument and just call a function. Why bother
> having a Set on the property to begin with? People are going to be setting the property to something - but that something will be
> complete ignored? Very confusing.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>I have a public property in my server control and I want to populate it with values generated by the control.
>>
>> When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that
>> says the function doesn't have all the other property values to work with.
>>
>> So, how do I populate the arraylist as a public property, so I can use it in my web page ?
>>
>>
>> ========== code in use ==========
>> I create the property wth the webpage by:
>>
>> ............
>> Dim arrTempList As New ArrayList()
>> oThis.myArrayList = arrTempList
>> ...........
>>
>>
>> I have the the property defined in the control as:
>>
>> ...............
>> Public arrChartList As Arraylist
>> Public Property myArrayList As ArrayList
>> Get
>> Return arrChartList
>> End Get
>> Set
>> arrChartList = myfunction() '<--builds values for arraylist
>> End Set
>> End Property
>> .................
>>
>>
>>
That depends on what you are trying to do in the first place. You either
want the user to assign a value to the property or you don't and want to
assign the variable a value returned by a function instead.
"Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
news:%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
> "myfunction" is in the control.
> Yes, I am totally confused on this and really need help.
> what should I be doing ?
>
>
> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message
> news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
>> Where is 'myfunction' declared? This looks like a scoping issue.
>>
>> I am also confused why in the Set for a property, you would completely
>> ignore the argument and just call a function. Why bother having a Set on
>> the property to begin with? People are going to be setting the property
>> to something - but that something will be complete ignored? Very
>> confusing.
>>
>> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message
>> news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>>I have a public property in my server control and I want to populate it
>>>with values generated by the control.
>>>
>>> When I assign the value of the property to a function in the control,
>>> which creates the values, I get a compilation error that says the
>>> function doesn't have all the other property values to work with.
>>>
>>> So, how do I populate the arraylist as a public property, so I can use
>>> it in my web page ?
>>>
>>>
>>> ========== code in use ==========
>>> I create the property wth the webpage by:
>>>
>>> ............
>>> Dim arrTempList As New ArrayList()
>>> oThis.myArrayList = arrTempList
>>> ...........
>>>
>>>
>>> I have the the property defined in the control as:
>>>
>>> ...............
>>> Public arrChartList As Arraylist
>>> Public Property myArrayList As ArrayList
>>> Get
>>> Return arrChartList
>>> End Get
>>> Set
>>> arrChartList = myfunction() '<--builds values for
>>> arraylist
>>> End Set
>>> End Property
>>> .................
>>>
>>>
>>>
>>
>>
I want the property to have the value created by the function.
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:uW8uI$PSGHA.1780@.TK2MSFTNGP12.phx.gbl...
> That depends on what you are trying to do in the first place. You either want the user to assign a value to the property or you
> don't and want to assign the variable a value returned by a function instead.
> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:%23jldn$HSGHA.224@.TK2MSFTNGP10.phx.gbl...
>> "myfunction" is in the control.
>>
>> Yes, I am totally confused on this and really need help.
>>
>> what should I be doing ?
>>
>>
>>
>>
>>
>> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message news:%236og2UHSGHA.4440@.TK2MSFTNGP11.phx.gbl...
>>> Where is 'myfunction' declared? This looks like a scoping issue.
>>>
>>> I am also confused why in the Set for a property, you would completely ignore the argument and just call a function. Why bother
>>> having a Set on the property to begin with? People are going to be setting the property to something - but that something will
>>> be complete ignored? Very confusing.
>>>
>>> "Jon Paal" <Jon[ nospam ]Paal @. everywhere dot com> wrote in message news:evc1ARHSGHA.5908@.TK2MSFTNGP10.phx.gbl...
>>>>I have a public property in my server control and I want to populate it with values generated by the control.
>>>>
>>>> When I assign the value of the property to a function in the control, which creates the values, I get a compilation error that
>>>> says the function doesn't have all the other property values to work with.
>>>>
>>>> So, how do I populate the arraylist as a public property, so I can use it in my web page ?
>>>>
>>>>
>>>> ========== code in use ==========
>>>> I create the property wth the webpage by:
>>>>
>>>> ............
>>>> Dim arrTempList As New ArrayList()
>>>> oThis.myArrayList = arrTempList
>>>> ...........
>>>>
>>>>
>>>> I have the the property defined in the control as:
>>>>
>>>> ...............
>>>> Public arrChartList As Arraylist
>>>> Public Property myArrayList As ArrayList
>>>> Get
>>>> Return arrChartList
>>>> End Get
>>>> Set
>>>> arrChartList = myfunction() '<--builds values for arraylist
>>>> End Set
>>>> End Property
>>>> .................
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
Wednesday, March 21, 2012
Populate textbox with dropdown selection (in Wizard Control), using javascript
I have a Wizard Control that contains a number of controls:
After the user selects an item from a DropDown, and the control has lostfocus, I need the selected value to pre-populate a TextBox usingjavascript.
If I create a 'new website' and just throw a dropdown list and textbox onto the page the following code works perfectly:
** Default.aspx.vb:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
DropDownList1.Attributes.Add("onblur", "FillTextbox()")
End Sub
** Default.aspx:
function FillTextbox ()
{
document.getElementById("TextBox1").value=document.getElementById("DropDownList1").value;
}
The above code, however DOESN'T work if the controls are embedded in a wizard control.
Thus, my question is: How do I get the code to work if the DropDown and TextBox controls are in a Wizard Control?
Any help would be much appreciated!
I believe when the control is embedded within another control the actual name that ends up being used includes the parent-control's name, e.g. Parent_mycontrol. Take a look at the source (right click, View Source) when you run the page to find the actual name of the control. You can reference it by that name in your javascript, fillTextbox() function.
Good luck.
You need to find the correct ID for the TextBox control. As suggested by the fellow developer you need to use the View Source and find the correct ID for the TextBox control. Once, you find the correct ID simply use that Id in the javascript function.
Thank you both SO MUCH for your help! That worked like a charm!
populating & Submitting an external form
In windows forms this can be done using the microsoft web browser control, but how is it done in asp.net either using the axwebbrowser control or httpwebrequest methods
this is an example description only actul sites and stuff will be different
I want my web site to do a search on google so on my site the user enters the input value into a text box, and they press send data.
This is then passed to google via some kind of magic, (ie webrequest) and we populate the google input box and press the search button, when we get our results back from google, i run the response via my regular expression and display the results in my own format.
I dont actully want to spider googles results its just the method is the closest description i can give to what i want to do.
I have been looking at posting data with the httpwebrequest and response methods but im not sure on it.
Can someone advise of the best possible method to handle such events
regards
Carlbump
Try the Google Web Services, even the free subscription allows you loads of searches.
You just make your own pages but use Google to do the searches, very straightforward.
i did say that i only was using google as an example
Populating a control with HTML file contents, images included?
publicvoid LoadToLabel()
{
using (StreamReader rdr =newStreamReader(FileUpload1.PostedFile.FileName))
{
string uploadedHTML = rdr.ReadToEnd();
textLabel.Text = uploadedHTML.ToString();
}
}
So far I have that, but the problem is that if the HTML file has an image displayed in it, the image doesn't show up because it's just copying the text. How would I be able to transfer the entire HTML page to a control? Like a panel or something like that, is it possible? And have the images come with it?
You should use LiteralControl for this purpose.
So if I switch it to a literal would it display the images as well?
I just switched it to a literal control and it still ignores the images. What must I do?
Yup. The LiteralControl will display the HTML exactly as you create it. See it as a place holder for output you create from code behind. Good luck!
OK, let me get this straight. You upload a HTML document containing <img> tags, which you then want to print out in the page, right?
If you do a view source in the resulting page, how does it look?
If the image urls in the uploaded page are relative then that is maybe what's causing the problem. Please give an example of how this tag looks like.
Also, if you upload a complete HTML document (with head/body) then you will render a page that is not valid (containing duplicate elements).
What does image urls being relative mean? Like pointing to a specific spot and not "~/Images/image.gif" etc.?
I did a view source on the page that uploads and displays the HTML document and yes you're right, there are now duplicate elements. It uploads everything within the uploaded documents <HTML></HTML> tags. How do I go about just grabbing what's in the body, and not the body tags themselves as that would be a duplicate element as well?
A relative path is one that does not begin with a / or http://something, example:
<img src="http://pics.10026.com/?src=images/ticker.gif">
A relative path is always calculated from the place where it is accessed.
If your (uploaded) page contains relative image paths, then to display these images correctly, you need to either rebuild the path (by parsing), or copy the contents of the path into the same folder as your upload page (not a viable solution).
Or you could make sure the user uploads all the images as well.
In either way, you have some parsing to do in order to get the uploaded file to display correctly. Also you must parse the file to get the actual contents of the file, and get past <html><body> and so on.
One option you have is to show the uploaded file in an iframe which would allow you to show the document as-is (although images would still require parsing).
How would I go about parsing the uploaded file so it displays properly with the images included within the literal control?
Strange... I could almost see that question coming Well, parsing text is not trivial, and I am not able to give you the code as it would take some time to develop and test. But here's how I would do: Define a regexp, that finds <img tags, and then replaces the src value with your "path prefixed" value.
Problem is that these tags can come in so many flavours, it's almost impossible to guarantee that the parser matches them correctly. Parsing HTML is kind of re-inventing the wheel again (the wheel being the browser ;-)
Uhm, I'm sorry, can't help you any further with this. But if you google a little on Regular expressions and spend some time trialing and erroring then you might reach your goal. Good luck!
Thank you so much for your help!
populating a datagrid from a parameterized procedure during page load
I have a datagrid control on my page populated from a parameterized stored procedure. The parameter comes from a label control on my page as seen below. I cannot get the grid to populate. Any suggestions?
Dim LocalIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If LocalIP =""Then
LocalIP = Request.ServerVariables("REMOTE_ADDR")
EndIf
Label1.Text = LocalIP
TIA <JP>
Hi paskettj,
first check if Label1.text has been assigned to the correct value(mean, what's the value of " LocalIP" ? you can use debug, or response.write to monitor it);
secondly,check if your sotred procedure has returned the correct data;
and the third, pls check if you have use datagrid correctly. To get your datagrid control populated with corresponding data,First, you need to set the correct DataSource or DataSourceID, then call the Databind() method. It doesn't matter where you get your data from(whether it's from a table,backend database, from parameterized stored procedure...etc).
for more detailed information, i suggest you reading some material by clicking the following links:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.basedatalist.datasource(VS.71).aspx (the sample within this page should help u use datagrid)
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.aspx (to a overview of datagird class)
hope my suggestion helps :)
Populating a DB from a DropDownList Control
form and having some difficulties. I'm completely open for
suggestions. I'm using VS.net 2003, and what iwould like to accomplish
is to have a form with two dropdown Boxes a button and a datagrid to
display what was selected from the drop downs. One of the drop downs
values can not be used more than once while the others can be repeated
as often as they like. Being that I'm a somewhat new developer I'm
finding even the easiest tasks to be difficult. The DropDownBoxes are
server controls that I pre-populated from in the aspx html. These
values will change very infrequently, so editing the aspx to add more
shouldn't be a problem. The problem that I'm having is that I can not
get any values to show in the Data Grid. These values must also be
stored in a DB that I created. I'm

would need, how to configure them. I have a SQLConnection control and
it is, to my belief able to connect to the DB. I have also read to
have a SQLCommand control and a SQLDataAdapter control. Any assistance
is greatly appreciated. Thanks, WillTry this.
Dim myConn as SqlConnection = New SqlConnection(Connection string)
Dim myDa as SqlDataAdapter = new SqlDataAdapter("Select query", myConn)
myConn.Open()
Dim myDs as DataSet = New DataSet
myDa.Fill(Ds, "All") '{populate Dataset with data
'Bind data to datagrid
datagrid1.DataSource = Ds
datagrid1.DataBind()
wcaruso welcome to the forum..
Try looking at this sample at:-
http://aspnet101.com/aspnet101/aspn...e.aspx?code=md2
It should guide you.
Also try seeing through quickstart at:-
http://asp.net/Tutorials/quickstart.aspx
Hope that helps
Patrick
<wcaruso@.gmail.com> wrote in message
news:1130962262.235096.310430@.g44g2000cwa.googlegroups.com...
> Good afternoon. I'm in the midst of writing up a pretty "basic" web
> form and having some difficulties. I'm completely open for
> suggestions. I'm using VS.net 2003, and what iwould like to accomplish
> is to have a form with two dropdown Boxes a button and a datagrid to
> display what was selected from the drop downs. One of the drop downs
> values can not be used more than once while the others can be repeated
> as often as they like. Being that I'm a somewhat new developer I'm
> finding even the easiest tasks to be difficult. The DropDownBoxes are
> server controls that I pre-populated from in the aspx html. These
> values will change very infrequently, so editing the aspx to add more
> shouldn't be a problem. The problem that I'm having is that I can not
> get any values to show in the Data Grid. These values must also be
> stored in a DB that I created. I'm

> would need, how to configure them. I have a SQLConnection control and
> it is, to my belief able to connect to the DB. I have also read to
> have a SQLCommand control and a SQLDataAdapter control. Any assistance
> is greatly appreciated. Thanks, Will
>
Populating a DB from a DropDownList Control
form and having some difficulties. I'm completely open for
suggestions. I'm using VS.net 2003, and what iwould like to accomplish
is to have a form with two dropdown Boxes a button and a datagrid to
display what was selected from the drop downs. One of the drop downs
values can not be used more than once while the others can be repeated
as often as they like. Being that I'm a somewhat new developer I'm
finding even the easiest tasks to be difficult. The DropDownBoxes are
server controls that I pre-populated from in the aspx html. These
values will change very infrequently, so editing the aspx to add more
shouldn't be a problem. The problem that I'm having is that I can not
get any values to show in the Data Grid. These values must also be
stored in a DB that I created. I'm confused on what Data Controls I
would need, how to configure them. I have a SQLConnection control and
it is, to my belief able to connect to the DB. I have also read to
have a SQLCommand control and a SQLDataAdapter control. Any assistance
is greatly appreciated. Thanks, WillTry this.
Dim myConn as SqlConnection = New SqlConnection(Connection string)
Dim myDa as SqlDataAdapter = new SqlDataAdapter("Select query", myConn)
myConn.Open()
Dim myDs as DataSet = New DataSet
myDa.Fill(Ds, "All") '{populate Dataset with data
'Bind data to datagrid
datagrid1.DataSource = Ds
datagrid1.DataBind()
wcaruso welcome to the forum..
Try looking at this sample at:-
http://aspnet101.com/aspnet101/aspn...e.aspx?code=md2
It should guide you.
Also try seeing through quickstart at:-
http://asp.net/Tutorials/quickstart.aspx
Hope that helps
Patrick
<wcaruso@.gmail.com> wrote in message
news:1130962262.235096.310430@.g44g2000cwa.googlegr oups.com...
> Good afternoon. I'm in the midst of writing up a pretty "basic" web
> form and having some difficulties. I'm completely open for
> suggestions. I'm using VS.net 2003, and what iwould like to accomplish
> is to have a form with two dropdown Boxes a button and a datagrid to
> display what was selected from the drop downs. One of the drop downs
> values can not be used more than once while the others can be repeated
> as often as they like. Being that I'm a somewhat new developer I'm
> finding even the easiest tasks to be difficult. The DropDownBoxes are
> server controls that I pre-populated from in the aspx html. These
> values will change very infrequently, so editing the aspx to add more
> shouldn't be a problem. The problem that I'm having is that I can not
> get any values to show in the Data Grid. These values must also be
> stored in a DB that I created. I'm confused on what Data Controls I
> would need, how to configure them. I have a SQLConnection control and
> it is, to my belief able to connect to the DB. I have also read to
> have a SQLCommand control and a SQLDataAdapter control. Any assistance
> is greatly appreciated. Thanks, Will
populating a Drop down list
I need to populate a drop down list when the user clicks
on the arrow button.
how do i do this.
Should i use a html select control or is it possible
using the asp:dropdownlistBoth are ok.
for saving program code, you can choose DropDownList,
if your data come from db, two lines will give your the result
ddl.DataSource = yourProcedure;
ddl.DataBind();
> hello,
> I need to populate a drop down list when the user clicks
> on the arrow button.
> how do i do this.
> Should i use a html select control or is it possible
> using the asp:dropdownlist
What i mean is that the list should only be populated
when the user clicks on it.
Until then it should be empty
>--Original Message--
>Both are ok.
>for saving program code, you can choose DropDownList,
> if your data come from db, two lines will give your the
result
> ddl.DataSource = yourProcedure;
> ddl.DataBind();
>> hello,
>>
>> I need to populate a drop down list when the user
clicks
>> on the arrow button.
>>
>> how do i do this.
>>
>> Should i use a html select control or is it possible
>> using the asp:dropdownlist
>>
>>
>
>.
Can you supply your reasoning for this requirement? This is not the
normal usage of this type of control. You can certainly populate the
list based on selections from other controls, but it might be
difficult to do using the onclick event of the listbox itself.
On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
<anonymous@.discussions.microsoft.com> wrote:
>
>What i mean is that the list should only be populated
>when the user clicks on it.
>Until then it should be empty
>
>
>>--Original Message--
>>Both are ok.
>>
>>for saving program code, you can choose DropDownList,
>>
>> if your data come from db, two lines will give your the
>result
>> ddl.DataSource = yourProcedure;
>> ddl.DataBind();
>>
>>> hello,
>>>
>>> I need to populate a drop down list when the user
>clicks
>>> on the arrow button.
>>>
>>> how do i do this.
>>>
>>> Should i use a html select control or is it possible
>>> using the asp:dropdownlist
>>>
>>>
>>
>>
>>.
>
Dan,
I am connecting to server at a distant location to
retrieve the data for the listbox, and the data has to be
loaded up only when the user wants to look at the
information,
I know there are other ways of doing this but this is
requested by the user
can you give me any ideas on this..
>--Original Message--
>Can you supply your reasoning for this requirement? This
is not the
>normal usage of this type of control. You can certainly
populate the
>list based on selections from other controls, but it
might be
>difficult to do using the onclick event of the listbox
itself.
>
>On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
><anonymous@.discussions.microsoft.com> wrote:
>>
>>
>>What i mean is that the list should only be populated
>>when the user clicks on it.
>>
>>Until then it should be empty
>>
>>
>>
>>
>>>--Original Message--
>>>Both are ok.
>>>
>>>for saving program code, you can choose DropDownList,
>>>
>>> if your data come from db, two lines will give your
the
>>result
>>> ddl.DataSource = yourProcedure;
>>> ddl.DataBind();
>>>
>>>> hello,
>>>>
>>>> I need to populate a drop down list when the user
>>clicks
>>>> on the arrow button.
>>>>
>>>> how do i do this.
>>>>
>>>> Should i use a html select control or is it possible
>>>> using the asp:dropdownlist
>>>>
>>>>
>>>
>>>
>>>.
>>>
>.
There is a user event that occurs when you click on the dropdown list
I think (not 100% sure). You may be able to link to that. However...
If you are going to go to the server to get the data, this will be a
significant pause to build the list. Also, when you come back, you
would have to manually "open" that list as if you just clicked on it.
Not exactly a smooth transition.
I suggest that you should be able to determine when the list would
need to be built and do this when necessary. Worst case, provide a
button that says "Load List" that the user can click and then populate
the dropdown list.
On Mon, 5 Jul 2004 14:19:26 -0700, "Casey"
<anonymous@.discussions.microsoft.com> wrote:
>Dan,
> I am connecting to server at a distant location to
>retrieve the data for the listbox, and the data has to be
>loaded up only when the user wants to look at the
>information,
>I know there are other ways of doing this but this is
>requested by the user
>can you give me any ideas on this..
>
>>--Original Message--
>>Can you supply your reasoning for this requirement? This
>is not the
>>normal usage of this type of control. You can certainly
>populate the
>>list based on selections from other controls, but it
>might be
>>difficult to do using the onclick event of the listbox
>itself.
>>
>>
>>On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
>><anonymous@.discussions.microsoft.com> wrote:
>>
>>>
>>>
>>>What i mean is that the list should only be populated
>>>when the user clicks on it.
>>>
>>>Until then it should be empty
>>>
>>>
>>>
>>>
>>>>--Original Message--
>>>>Both are ok.
>>>>
>>>>for saving program code, you can choose DropDownList,
>>>>
>>>> if your data come from db, two lines will give your
>the
>>>result
>>>> ddl.DataSource = yourProcedure;
>>>> ddl.DataBind();
>>>>
>>>>> hello,
>>>>>
>>>>> I need to populate a drop down list when the user
>>>clicks
>>>>> on the arrow button.
>>>>>
>>>>> how do i do this.
>>>>>
>>>>> Should i use a html select control or is it possible
>>>>> using the asp:dropdownlist
>>>>>
>>>>>
>>>>
>>>>
>>>>.
>>>>
>>
>>.
>
thanks for your help dan..
I will take your advice,
regards
casey
>--Original Message--
>There is a user event that occurs when you click on the
dropdown list
>I think (not 100% sure). You may be able to link to
that. However...
>If you are going to go to the server to get the data,
this will be a
>significant pause to build the list. Also, when you come
back, you
>would have to manually "open" that list as if you just
clicked on it.
>Not exactly a smooth transition.
>I suggest that you should be able to determine when the
list would
>need to be built and do this when necessary. Worst case,
provide a
>button that says "Load List" that the user can click and
then populate
>the dropdown list.
>
>On Mon, 5 Jul 2004 14:19:26 -0700, "Casey"
><anonymous@.discussions.microsoft.com> wrote:
>>Dan,
>>
>> I am connecting to server at a distant location to
>>retrieve the data for the listbox, and the data has to
be
>>loaded up only when the user wants to look at the
>>information,
>>
>>I know there are other ways of doing this but this is
>>requested by the user
>>
>>can you give me any ideas on this..
>>
>>
>>
>>>--Original Message--
>>>Can you supply your reasoning for this requirement?
This
>>is not the
>>>normal usage of this type of control. You can
certainly
>>populate the
>>>list based on selections from other controls, but it
>>might be
>>>difficult to do using the onclick event of the listbox
>>itself.
>>>
>>>
>>>On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
>>><anonymous@.discussions.microsoft.com> wrote:
>>>
>>>>
>>>>
>>>>What i mean is that the list should only be populated
>>>>when the user clicks on it.
>>>>
>>>>Until then it should be empty
>>>>
>>>>
>>>>
>>>>
>>>>>--Original Message--
>>>>>Both are ok.
>>>>>
>>>>>for saving program code, you can choose DropDownList,
>>>>>
>>>>> if your data come from db, two lines will give your
>>the
>>>>result
>>>>> ddl.DataSource = yourProcedure;
>>>>> ddl.DataBind();
>>>>>
>>>>>> hello,
>>>>>>
>>>>>> I need to populate a drop down list when the user
>>>>clicks
>>>>>> on the arrow button.
>>>>>>
>>>>>> how do i do this.
>>>>>>
>>>>>> Should i use a html select control or is it
possible
>>>>>> using the asp:dropdownlist
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>.
>>>>>
>>>
>>>.
>>>
>.
populating a Drop down list
I need to populate a drop down list when the user clicks
on the arrow button.
how do i do this.
Should i use a html select control or is it possible
using the asp:dropdownlistBoth are ok.
for saving program code, you can choose DropDownList,
if your data come from db, two lines will give your the result
ddl.DataSource = yourProcedure;
ddl.DataBind();
> hello,
> I need to populate a drop down list when the user clicks
> on the arrow button.
> how do i do this.
> Should i use a html select control or is it possible
> using the asp:dropdownlist
>
What i mean is that the list should only be populated
when the user clicks on it.
Until then it should be empty
>--Original Message--
>Both are ok.
>for saving program code, you can choose DropDownList,
> if your data come from db, two lines will give your the
result
> ddl.DataSource = yourProcedure;
> ddl.DataBind();
>
clicks
>
>.
>
Can you supply your reasoning for this requirement? This is not the
normal usage of this type of control. You can certainly populate the
list based on selections from other controls, but it might be
difficult to do using the onclick event of the listbox itself.
On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
<anonymous@.discussions.microsoft.com> wrote:
>
>What i mean is that the list should only be populated
>when the user clicks on it.
>Until then it should be empty
>
>
>result
>clicks
Dan,
I am connecting to server at a distant location to
retrieve the data for the listbox, and the data has to be
loaded up only when the user wants to look at the
information,
I know there are other ways of doing this but this is
requested by the user
can you give me any ideas on this..
>--Original Message--
>Can you supply your reasoning for this requirement? This
is not the
>normal usage of this type of control. You can certainly
populate the
>list based on selections from other controls, but it
might be
>difficult to do using the onclick event of the listbox
itself.
>
>On Mon, 5 Jul 2004 07:28:15 -0700, "Casey"
><anonymous@.discussions.microsoft.com> wrote:
>
the
>.
>
There is a user event that occurs when you click on the dropdown list
I think (not 100% sure). You may be able to link to that. However...
If you are going to go to the server to get the data, this will be a
significant pause to build the list. Also, when you come back, you
would have to manually "open" that list as if you just clicked on it.
Not exactly a smooth transition.
I suggest that you should be able to determine when the list would
need to be built and do this when necessary. Worst case, provide a
button that says "Load List" that the user can click and then populate
the dropdown list.
On Mon, 5 Jul 2004 14:19:26 -0700, "Casey"
<anonymous@.discussions.microsoft.com> wrote:
>Dan,
> I am connecting to server at a distant location to
>retrieve the data for the listbox, and the data has to be
>loaded up only when the user wants to look at the
>information,
>I know there are other ways of doing this but this is
>requested by the user
>can you give me any ideas on this..
>
>
>is not the
>populate the
>might be
>itself.
>the
thanks for your help dan..
I will take your advice,
regards
casey
>--Original Message--
>There is a user event that occurs when you click on the
dropdown list
>I think (not 100% sure). You may be able to link to
that. However...
>If you are going to go to the server to get the data,
this will be a
>significant pause to build the list. Also, when you come
back, you
>would have to manually "open" that list as if you just
clicked on it.
>Not exactly a smooth transition.
>I suggest that you should be able to determine when the
list would
>need to be built and do this when necessary. Worst case,
provide a
>button that says "Load List" that the user can click and
then populate
>the dropdown list.
>
>On Mon, 5 Jul 2004 14:19:26 -0700, "Casey"
><anonymous@.discussions.microsoft.com> wrote:
>
be
This
certainly
possible
>.
>
Populating a dropdown control
recordset and I am getting the following values in the dropdown
System.Data.DataRowView and not the expected content that should be
appearing in there. I have stepped through the code in debug mode and
examine the value of the recordset, and the right values seem to be there.
Any idea what is causing this and how to fix it so that it does not show up
like this?
.ResetParameters()
.AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
ctlHeader.PatientData("PatientMRN"))
'Pull back the list of encounters for the selected patient
If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
Dim oRow As DataRow
oData = .DbData_DataTable
If .DbData_DataTable.Rows.Count > 0 Then
With drpEnc
.DataSource = oData
.DataBind()
.DataValueField = "id"
.DataTextField = "DateOfService"
End With
End If
Else
Throw New Exception(.ErrorMessage)
End If 'Encounter List
J.Daly
structure:interactive
Ph: 616-364-7423
Fx: 616-364-6941
http://www.structureinteractive.comSe the DataText and DataVauleField properties BEFORE the DataBind().
DataBind() binds your source to your control, setting what to bind after
doesn't work :)
Karl
"Irishmaninusa"
<jdaly@.structuctureinteractive.com.takemeoffifyouwantoemailme> wrote in
message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
> I am trying to populate a drop down on a form with the contents of a
> recordset and I am getting the following values in the dropdown
> System.Data.DataRowView and not the expected content that should be
> appearing in there. I have stepped through the code in debug mode and
> examine the value of the recordset, and the right values seem to be there.
> Any idea what is causing this and how to fix it so that it does not show
up
> like this?
>
>
> .ResetParameters()
> .AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
> ctlHeader.PatientData("PatientMRN"))
> 'Pull back the list of encounters for the selected patient
> If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
> Dim oRow As DataRow
> oData = .DbData_DataTable
>
> If .DbData_DataTable.Rows.Count > 0 Then
> With drpEnc
> .DataSource = oData
> .DataBind()
> .DataValueField = "id"
> .DataTextField = "DateOfService"
> End With
> End If
> Else
> Throw New Exception(.ErrorMessage)
> End If 'Encounter List
>
> --
> J.Daly
> structure:interactive
> Ph: 616-364-7423
> Fx: 616-364-6941
> http://www.structureinteractive.com
>
>
I thought I had did that before and it still didn't work, but I tried it
again and this time it work. Now I have different issue, the stored
procedure I call pulls back date values in order, where the most recent date
is at the top and it goes back in order.
7/28/2004
7/1/2004
6/30/2004
This is the where the stored procedure pulls back the dates, which is
correct. However in the drop down it is being displayed as
7/28/2004
6/30/2004
7/1/2004
Why would this be like this?
"Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:OzuKbe3iEHA.636@.TK2MSFTNGP12.phx.gbl...
> Se the DataText and DataVauleField properties BEFORE the DataBind().
> DataBind() binds your source to your control, setting what to bind after
> doesn't work :)
> Karl
> "Irishmaninusa"
> <jdaly@.structuctureinteractive.com.takemeoffifyouwantoemailme> wrote in
> message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
there.
> up
>
I honestly don't know. I can see that you are using OLEdbClient which I'm
no expert at. Are these Date fields or string/varchar fields? you may want
to start a new thread asking this question and identifying the
database/query/schema so that someone better suited will help.
Karl
"Irishmaninusa"
<jdaly@.structuctureinteractive.com.takemeoffifyouwantoemailme> wrote in
message news:e2sIEo3iEHA.536@.TK2MSFTNGP11.phx.gbl...
> I thought I had did that before and it still didn't work, but I tried it
> again and this time it work. Now I have different issue, the stored
> procedure I call pulls back date values in order, where the most recent
date
> is at the top and it goes back in order.
> 7/28/2004
> 7/1/2004
> 6/30/2004
> This is the where the stored procedure pulls back the dates, which is
> correct. However in the drop down it is being displayed as
>
> 7/28/2004
> 6/30/2004
> 7/1/2004
> Why would this be like this?
> "Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
> message news:OzuKbe3iEHA.636@.TK2MSFTNGP12.phx.gbl...
> there.
show
ParameterDirection.Input,
>
Thanks Karl, I will see what turns up. Thank you for your help to my earlier
issue.
"Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:umG6hJ4iEHA.1376@.TK2MSFTNGP11.phx.gbl...
> I honestly don't know. I can see that you are using OLEdbClient which I'm
> no expert at. Are these Date fields or string/varchar fields? you may
want
> to start a new thread asking this question and identifying the
> database/query/schema so that someone better suited will help.
> Karl
> "Irishmaninusa"
> <jdaly@.structuctureinteractive.com.takemeoffifyouwantoemailme> wrote in
> message news:e2sIEo3iEHA.536@.TK2MSFTNGP11.phx.gbl...
> date
in
after
in
and
> show
> ParameterDirection.Input,
>
Populating a dropdown control
recordset and I am getting the following values in the dropdown
System.Data.DataRowView and not the expected content that should be
appearing in there. I have stepped through the code in debug mode and
examine the value of the recordset, and the right values seem to be there.
Any idea what is causing this and how to fix it so that it does not show up
like this?
..ResetParameters()
..AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
ctlHeader.PatientData("PatientMRN"))
'Pull back the list of encounters for the selected patient
If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
Dim oRow As DataRow
oData = .DbData_DataTable
If .DbData_DataTable.Rows.Count > 0 Then
With drpEnc
..DataSource = oData
..DataBind()
..DataValueField = "id"
..DataTextField = "DateOfService"
End With
End If
Else
Throw New Exception(.ErrorMessage)
End If 'Encounter List
--
J.Daly
structure:interactive
Ph: 616-364-7423
Fx: 616-364-6941
http://www.structureinteractive.comSe the DataText and DataVauleField properties BEFORE the DataBind().
DataBind() binds your source to your control, setting what to bind after
doesn't work :)
Karl
"Irishmaninusa"
<jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote in
message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
> I am trying to populate a drop down on a form with the contents of a
> recordset and I am getting the following values in the dropdown
> System.Data.DataRowView and not the expected content that should be
> appearing in there. I have stepped through the code in debug mode and
> examine the value of the recordset, and the right values seem to be there.
> Any idea what is causing this and how to fix it so that it does not show
up
> like this?
>
>
> .ResetParameters()
> .AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
> ctlHeader.PatientData("PatientMRN"))
> 'Pull back the list of encounters for the selected patient
> If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
> Dim oRow As DataRow
> oData = .DbData_DataTable
>
> If .DbData_DataTable.Rows.Count > 0 Then
> With drpEnc
> .DataSource = oData
> .DataBind()
> .DataValueField = "id"
> .DataTextField = "DateOfService"
> End With
> End If
> Else
> Throw New Exception(.ErrorMessage)
> End If 'Encounter List
>
> --
> J.Daly
> structure:interactive
> Ph: 616-364-7423
> Fx: 616-364-6941
> http://www.structureinteractive.com
I thought I had did that before and it still didn't work, but I tried it
again and this time it work. Now I have different issue, the stored
procedure I call pulls back date values in order, where the most recent date
is at the top and it goes back in order.
7/28/2004
7/1/2004
6/30/2004
This is the where the stored procedure pulls back the dates, which is
correct. However in the drop down it is being displayed as
7/28/2004
6/30/2004
7/1/2004
Why would this be like this?
"Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:OzuKbe3iEHA.636@.TK2MSFTNGP12.phx.gbl...
> Se the DataText and DataVauleField properties BEFORE the DataBind().
> DataBind() binds your source to your control, setting what to bind after
> doesn't work :)
> Karl
> "Irishmaninusa"
> <jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote in
> message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
> > I am trying to populate a drop down on a form with the contents of a
> > recordset and I am getting the following values in the dropdown
> > System.Data.DataRowView and not the expected content that should be
> > appearing in there. I have stepped through the code in debug mode and
> > examine the value of the recordset, and the right values seem to be
there.
> > Any idea what is causing this and how to fix it so that it does not show
> up
> > like this?
> > .ResetParameters()
> > .AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
> > ctlHeader.PatientData("PatientMRN"))
> > 'Pull back the list of encounters for the selected patient
> > If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
> > Dim oRow As DataRow
> > oData = .DbData_DataTable
> > If .DbData_DataTable.Rows.Count > 0 Then
> > With drpEnc
> > .DataSource = oData
> > .DataBind()
> > .DataValueField = "id"
> > .DataTextField = "DateOfService"
> > End With
> > End If
> > Else
> > Throw New Exception(.ErrorMessage)
> > End If 'Encounter List
> > --
> > J.Daly
> > structure:interactive
> > Ph: 616-364-7423
> > Fx: 616-364-6941
> > http://www.structureinteractive.com
I honestly don't know. I can see that you are using OLEdbClient which I'm
no expert at. Are these Date fields or string/varchar fields? you may want
to start a new thread asking this question and identifying the
database/query/schema so that someone better suited will help.
Karl
"Irishmaninusa"
<jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote in
message news:e2sIEo3iEHA.536@.TK2MSFTNGP11.phx.gbl...
> I thought I had did that before and it still didn't work, but I tried it
> again and this time it work. Now I have different issue, the stored
> procedure I call pulls back date values in order, where the most recent
date
> is at the top and it goes back in order.
> 7/28/2004
> 7/1/2004
> 6/30/2004
> This is the where the stored procedure pulls back the dates, which is
> correct. However in the drop down it is being displayed as
>
> 7/28/2004
> 6/30/2004
> 7/1/2004
> Why would this be like this?
> "Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
> message news:OzuKbe3iEHA.636@.TK2MSFTNGP12.phx.gbl...
> > Se the DataText and DataVauleField properties BEFORE the DataBind().
> > DataBind() binds your source to your control, setting what to bind after
> > doesn't work :)
> > Karl
> > "Irishmaninusa"
> > <jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote in
> > message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
> > > I am trying to populate a drop down on a form with the contents of a
> > > recordset and I am getting the following values in the dropdown
> > > > System.Data.DataRowView and not the expected content that should be
> > > appearing in there. I have stepped through the code in debug mode and
> > > examine the value of the recordset, and the right values seem to be
> there.
> > > > Any idea what is causing this and how to fix it so that it does not
show
> > up
> > > like this?
> > > > > > > > .ResetParameters()
> > > > .AddParameter("iMRN", OleDb.OleDbType.Integer,
ParameterDirection.Input,
> > > ctlHeader.PatientData("PatientMRN"))
> > > > 'Pull back the list of encounters for the selected patient
> > > > If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
> > > > Dim oRow As DataRow
> > > > oData = .DbData_DataTable
> > > > > > If .DbData_DataTable.Rows.Count > 0 Then
> > > > With drpEnc
> > > > .DataSource = oData
> > > > .DataBind()
> > > > .DataValueField = "id"
> > > > .DataTextField = "DateOfService"
> > > > End With
> > > > End If
> > > > Else
> > > > Throw New Exception(.ErrorMessage)
> > > > End If 'Encounter List
> > > > > --
> > > J.Daly
> > > structure:interactive
> > > Ph: 616-364-7423
> > > Fx: 616-364-6941
> > > > http://www.structureinteractive.com
> > >
Thanks Karl, I will see what turns up. Thank you for your help to my earlier
issue.
"Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:umG6hJ4iEHA.1376@.TK2MSFTNGP11.phx.gbl...
> I honestly don't know. I can see that you are using OLEdbClient which I'm
> no expert at. Are these Date fields or string/varchar fields? you may
want
> to start a new thread asking this question and identifying the
> database/query/schema so that someone better suited will help.
> Karl
> "Irishmaninusa"
> <jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote in
> message news:e2sIEo3iEHA.536@.TK2MSFTNGP11.phx.gbl...
> > I thought I had did that before and it still didn't work, but I tried it
> > again and this time it work. Now I have different issue, the stored
> > procedure I call pulls back date values in order, where the most recent
> date
> > is at the top and it goes back in order.
> > 7/28/2004
> > 7/1/2004
> > 6/30/2004
> > This is the where the stored procedure pulls back the dates, which is
> > correct. However in the drop down it is being displayed as
> > 7/28/2004
> > 6/30/2004
> > 7/1/2004
> > Why would this be like this?
> > "Karl" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net> wrote
in
> > message news:OzuKbe3iEHA.636@.TK2MSFTNGP12.phx.gbl...
> > > Se the DataText and DataVauleField properties BEFORE the DataBind().
> > > > DataBind() binds your source to your control, setting what to bind
after
> > > doesn't work :)
> > > > Karl
> > > > "Irishmaninusa"
> > > <jdaly@.structuctureinteractive.com.takemeoffifyouwa ntoemailme> wrote
in
> > > message news:u3boxQ3iEHA.2992@.TK2MSFTNGP12.phx.gbl...
> > > > I am trying to populate a drop down on a form with the contents of a
> > > > recordset and I am getting the following values in the dropdown
> > > > > > System.Data.DataRowView and not the expected content that should be
> > > > appearing in there. I have stepped through the code in debug mode
and
> > > > examine the value of the recordset, and the right values seem to be
> > there.
> > > > > > Any idea what is causing this and how to fix it so that it does not
> show
> > > up
> > > > like this?
> > > > > > > > > > > > > > .ResetParameters()
> > > > > > .AddParameter("iMRN", OleDb.OleDbType.Integer,
> ParameterDirection.Input,
> > > > ctlHeader.PatientData("PatientMRN"))
> > > > > > 'Pull back the list of encounters for the selected patient
> > > > > > If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then
> > > > > > Dim oRow As DataRow
> > > > > > oData = .DbData_DataTable
> > > > > > > > > > If .DbData_DataTable.Rows.Count > 0 Then
> > > > > > With drpEnc
> > > > > > .DataSource = oData
> > > > > > .DataBind()
> > > > > > .DataValueField = "id"
> > > > > > .DataTextField = "DateOfService"
> > > > > > End With
> > > > > > End If
> > > > > > Else
> > > > > > Throw New Exception(.ErrorMessage)
> > > > > > End If 'Encounter List
> > > > > > > > --
> > > > J.Daly
> > > > structure:interactive
> > > > Ph: 616-364-7423
> > > > Fx: 616-364-6941
> > > > > > http://www.structureinteractive.com
> > > > > > > >
Friday, March 16, 2012
Populating a text field and then getting its value
I am populating a text field dynamic in my code, and its a read-only
textbox control. It populates it perfectly fine. but when I get its value
back in code I get an empty string any clues as to how to get this sorted
please ?
Here is how I set the value of the control.
txtTitle.Text = feed.Channels[0].Title;
and get it later
String strString = txtTitle.Text;
Any clues please ?
Imran.Thats a strange one.
Working fine for me:
ASPX:
<asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
OnClick="Button1_Click"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
CS
void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
TextBox1.Text = "Hello";
}
void Button1_Click(object sender, System.EventArgs e)
{
Response.Write("Value: " + TextBox1.Text);
}
OUTPUT
Value: Hello
Try making a simple page like that and testing it
"Imran Aziz" <imran@.tb2.net> wrote in message
news:e43rNIcmFHA.2860@.TK2MSFTNGP15.phx.gbl...
> Hello All,
> I am populating a text field dynamic in my code, and its a read-only
> textbox control. It populates it perfectly fine. but when I get its value
> back in code I get an empty string any clues as to how to get this sorted
> please ?
> Here is how I set the value of the control.
> txtTitle.Text = feed.Channels[0].Title;
> and get it later
> String strString = txtTitle.Text;
> Any clues please ?
> Imran.
>
If I change the textbox property Readonly to false then it works perfectly
fine. I am using the latest Beta 2 release of .net framework.
Imran.
"Grant Merwitz" <grant@.workshare.com> wrote in message
news:O0YmSUcmFHA.576@.TK2MSFTNGP15.phx.gbl...
> Thats a strange one.
> Working fine for me:
> ASPX:
> <asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
> OnClick="Button1_Click"></asp:TextBox>
> <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
> CS
> void Page_Load(object sender, System.EventArgs e)
> {
> if(!Page.IsPostBack)
> TextBox1.Text = "Hello";
> }
> void Button1_Click(object sender, System.EventArgs e)
> {
> Response.Write("Value: " + TextBox1.Text);
> }
> OUTPUT
> Value: Hello
>
> Try making a simple page like that and testing it
>
> "Imran Aziz" <imran@.tb2.net> wrote in message
> news:e43rNIcmFHA.2860@.TK2MSFTNGP15.phx.gbl...
>
used the exact code, but does not work for me, the text value returned is
empty.
Imran.
"Grant Merwitz" <grant@.workshare.com> wrote in message
news:O0YmSUcmFHA.576@.TK2MSFTNGP15.phx.gbl...
> Thats a strange one.
> Working fine for me:
> ASPX:
> <asp:TextBox id="TextBox1" runat="server" ReadOnly="True"
> OnClick="Button1_Click"></asp:TextBox>
> <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
> CS
> void Page_Load(object sender, System.EventArgs e)
> {
> if(!Page.IsPostBack)
> TextBox1.Text = "Hello";
> }
> void Button1_Click(object sender, System.EventArgs e)
> {
> Response.Write("Value: " + TextBox1.Text);
> }
> OUTPUT
> Value: Hello
>
> Try making a simple page like that and testing it
>
> "Imran Aziz" <imran@.tb2.net> wrote in message
> news:e43rNIcmFHA.2860@.TK2MSFTNGP15.phx.gbl...
>
okay, i'm on v1.1
I have beta 2 on a machine here.
If i have time to test it before i go, i'll try run the example there
"Imran Aziz" <imran@.tb2.net> wrote in message
news:%23rwRZUdmFHA.2860@.TK2MSFTNGP15.phx.gbl...
> If I change the textbox property Readonly to false then it works
> perfectly fine. I am using the latest Beta 2 release of .net framework.
> Imran.
> "Grant Merwitz" <grant@.workshare.com> wrote in message
> news:O0YmSUcmFHA.576@.TK2MSFTNGP15.phx.gbl...
>
Thanks a lot.
Imran.
"Grant Merwitz" <grant@.workshare.com> wrote in message
news:u9$zKbdmFHA.3936@.TK2MSFTNGP10.phx.gbl...
> okay, i'm on v1.1
> I have beta 2 on a machine here.
> If i have time to test it before i go, i'll try run the example there
> "Imran Aziz" <imran@.tb2.net> wrote in message
> news:%23rwRZUdmFHA.2860@.TK2MSFTNGP15.phx.gbl...
>
Sorry it took me so long to try this.
But it's working fine for me on a Machine running Beta 2
"Imran Aziz" <imran@.tb2.net> wrote in message
news:ujgDxxdmFHA.2472@.TK2MSFTNGP15.phx.gbl...
> Thanks a lot.
> Imran.
> "Grant Merwitz" <grant@.workshare.com> wrote in message
> news:u9$zKbdmFHA.3936@.TK2MSFTNGP10.phx.gbl...
>
Hum strange I am doing something wrong then, I guess I will try and use
labels instead of text boxes.
Thanks a lot for coming back to me on that.
Imran
"Grant Merwitz" <grant@.workshare.com> wrote in message
news:eUjjZmNnFHA.3572@.TK2MSFTNGP09.phx.gbl...
> Sorry it took me so long to try this.
> But it's working fine for me on a Machine running Beta 2
>
> "Imran Aziz" <imran@.tb2.net> wrote in message
> news:ujgDxxdmFHA.2472@.TK2MSFTNGP15.phx.gbl...
>
Populating ComboBox From Dataset
I need to populate a combobox from a dataset returned from a webservice. I set the datasource property of the control to the web method but got an empty list at run time! What am I doing wrong? Any help on how to achieve this? Looping through a datareader solved the problem but I want to consume a dataset from a web service. I thought this would be a straight stuff but I'm having problems with it.After setting the datasource property you have to bind the data to your controll.
It seems you are missing that bit.
I can handle that with DropDownList control in ASP.Net but not with ComboBox in Windows Application! Could you kindly show how syntactically?
Are you getting an error?
What does it say?
Post your code so that we can see more clearly what has gone wrong
I am not getting any error message! I only get this wierd entry in the ComboBox. "System.Data.DataViewManagerListItemTypeDescriptor"
This is the code that I used.
Private Sub Users_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wsDemo As New ng_app001_pc_stock.PCInventory
ComboBox1.datasource = wsDemo.getAllOSTypes
End Sub
The webmethod getAllOSTypes works well, at least I tested it with DataGrid control. What could be wrong?
populating controls
<script>
public drpAge As DropDownList
Dim hashAge As new Hashtable()
Sub Control_Load(Sender As Object, E As EventArgs)
hashAge(0) = "Select Age "
hashAge(1) = "Less than 18"
hashAge(2) = "Between 18 & 21"
hashAge(3) = "Between 21 & 25"
hashAge(4) = "Greater than 25"
drpAge.DataSource = hashAge
drpAge.DataBind()
End Sub
</script
control is:
<ASP:DropDownList ID="drpAge" runat="server" /
It is showing dropdown list on the page, but not populating the list.
Plz help me.
& Also tell me how to write code behind file for controls.
I tryied it . I write a vb file(profile.vb) in which i write a class(profile_class) which Inherit Control class . When i write
in control (.ascx) file
<%@dotnet.itags.org. Control language="vb" Inherits="profile_class" src="http://pics.10026.com/?src=prifile.vb" %
It creates Application error
" 'profile_class' is not a valid base class to inherit from "
So plz help me
Thanx in Advance
AmitYou have to tell the hashtable what to display, another way would be to use a Collection instead of a hashtable:
In the Page_Load Sub you could add the following code:
Dim hashAge As New Collection()hashAge.Add("Select Age ")
hashAge.Add("Less than 18")
hashAge.Add("Between 18 & 21")
hashAge.Add("Between 21 & 25")
hashAge.Add("Greater than 25")drpAge.DataSource = hashAge
drpAge.DataBind()
Hi Ajay
Thanx
But Its not working
I think you're (quite understandably) confusing server controls and user controls.
First, server controls (such as the DropDownList you are using) do not have a Control_Load method which you can use to "initialise" this control.
So, you might change the name of your sub from
Sub Control_Load(Sender As Object, E As EventArgs)to
Sub drpAge_Initialise()and then, in your Page_Load method, call this sub:
Sub Page_Load(Sender As Object, E As EventArgs)
drpAge_Initialise()
End Sub
It's in your second question where you've got the two confused. (Again, understandably ... I think the ASP.NET framework should have changed the name of User Controls to something else ... in fact, they were originally called Pagelets.)
A codebehind for aUser control must inheritSystem.Web.UI.Web.UserControl.
Conversely, the code for aserver control generally inherits either fromSystem.Web.UI.Control or fromSystem.Web.UI.WebControl.
In the sample code you've shown, you're trying to create a codebehind for a User Control.
Does that help?
Thanx , Actually I am new to ASP.Net
I got it. Actually to create a user control i inhering Control class instead of UserControl.
Its working now.
Amit :)
Populating DataList control
to populate it through the page_load event.
The name of the control on the web page is "MyList".
I had code behind a button click to populate it and that
worked. Now that I've moved the code to the page_load
event it is not working. I suspect that "MyList" on the
page doesn't know about "MyList" in the page_load code
but I don't know how to connect the two. Any help would
be appreciated.
Here is the code
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim MyList As DataList
MyConnection = New SqlConnection
(" server=x2;database=Orders;Trusted_Connec
tion=yes")
MyCommand = New SqlDataAdapter("select
ReferenceNO, Loc from Request", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Request")
MyList = New DataList
MyList.DataSource = DS.Tables
("Request").DefaultView
MyList.DataBind()
.Hi, Jerry
From your code, I guess you are dynamically generating datalist.
However, I don't see any code to add the datalist to the page.
You need to add:
Page.Controls.Add(MyList)
Bin Song, MCP
Hi Bin,
I had added the DataList control from the toolbox. My
problem was that I had failed to add the
<%# DataBinder.Eval(Container.DataItem, "ReferenceNO") %>
inside the <td> tags in the control.
Thanks,
Jerry
>--Original Message--
>Hi, Jerry
>From your code, I guess you are dynamically generating
datalist.
>However, I don't see any code to add the datalist to the
page.
>You need to add:
>Page.Controls.Add(MyList)
>Bin Song, MCP
>.
>
So your problem solved or not?
Yes. Problem solved. Thanks.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!
Populating DataList control
to populate it through the page_load event.
The name of the control on the web page is "MyList".
I had code behind a button click to populate it and that
worked. Now that I've moved the code to the page_load
event it is not working. I suspect that "MyList" on the
page doesn't know about "MyList" in the page_load code
but I don't know how to connect the two. Any help would
be appreciated.
Here is the code
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim MyList As DataList
MyConnection = New SqlConnection
("server=x2;database=Orders;Trusted_Connection=yes")
MyCommand = New SqlDataAdapter("select
ReferenceNO, Loc from Request", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "Request")
MyList = New DataList
MyList.DataSource = DS.Tables
("Request").DefaultView
MyList.DataBind()
..Hi Bin,
I had added the DataList control from the toolbox. My
problem was that I had failed to add the
<%# DataBinder.Eval(Container.DataItem, "ReferenceNO") %
inside the <td> tags in the control.
Thanks,
Jerry
>--Original Message--
>Hi, Jerry
>From your code, I guess you are dynamically generating
datalist.
>However, I don't see any code to add the datalist to the
page.
>You need to add:
>Page.Controls.Add(MyList)
>Bin Song, MCP
>.
So your problem solved or not?
Yes. Problem solved. Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
populating dropdownlist (asp.net server ctrl) from clientside jscr
I tried to find out about populating an asp.net server control (a
dropdownlist) from the clientside jscript, but I didn't find a solution up
to now.
I cannot use a html dropdownlist, because a database query in codebehind has
to be done, when a new listItem is selected. So, I need to use a
servercontrol dropdownlist.
Now to my problem:
I have two dropdownlists in use. One of them should show listItems that are
dependent on the selection of the other one. I know that I need to use the
clientside onchange() Event on the dropdownlistbox that decides what has to
be shown in the other dropdownlist, because no postback should occur for this.
The C# syntax, that is used in codebehind, doesn't work, JScript gives me an
error that the object doesn't support this method.
I can set the text and state of servercontrols like textBoxes and checkBoxes
from clientside jscript with document.Form1.TextBox1..., so it should also be
possible to do this with a dropdownlist too, shouldn't it?
I tried it with Ajax.NET, but when I called a serverside function that
should manipulate the dropdownlist, a nullpointerexception occurs, because
all the instances of the serverside controls are "undefined" (I saw it in the
debugger). I've no explanation for this, as they are created on page_Load. So
I cancelled my efforts introducing Ajax into this. As the project is nearly
finished, I would like to avoid using Ajax for the dropdownlist stuff.
I hope somebody can help
Thanks in advance
RFS666var i = document.forms[0].DropDownListName.length
document.forms[0].DropDownListName.options[i] = new Option('new text','new
value');
HTH
"RFS666" wrote:
> Hello together,
> I tried to find out about populating an asp.net server control (a
> dropdownlist) from the clientside jscript, but I didn't find a solution up
> to now.
> I cannot use a html dropdownlist, because a database query in codebehind has
> to be done, when a new listItem is selected. So, I need to use a
> servercontrol dropdownlist.
> Now to my problem:
> I have two dropdownlists in use. One of them should show listItems that are
> dependent on the selection of the other one. I know that I need to use the
> clientside onchange() Event on the dropdownlistbox that decides what has to
> be shown in the other dropdownlist, because no postback should occur for this.
> The C# syntax, that is used in codebehind, doesn't work, JScript gives me an
> error that the object doesn't support this method.
> I can set the text and state of servercontrols like textBoxes and checkBoxes
> from clientside jscript with document.Form1.TextBox1..., so it should also be
> possible to do this with a dropdownlist too, shouldn't it?
> I tried it with Ajax.NET, but when I called a serverside function that
> should manipulate the dropdownlist, a nullpointerexception occurs, because
> all the instances of the serverside controls are "undefined" (I saw it in the
> debugger). I've no explanation for this, as they are created on page_Load. So
> I cancelled my efforts introducing Ajax into this. As the project is nearly
> finished, I would like to avoid using Ajax for the dropdownlist stuff.
> I hope somebody can help
> Thanks in advance
> RFS666
First, when the browser sees the control, it is no longer a server-side
control, but just HTML. You can do whatever you can with the control, but
it needs to be through JavaScript with JS syntax and commands. Take a look
at the
http://msdn.microsoft.com/workshop/...asp?frame=true
for information about the those lists from the IE perspective.
In order for the server objects to be populated, you must to some form of
postback, otherwise the server does not know what to do. You might consider
using SmartNavigation and performing postbacks without the screen flicker.
"RFS666" <RFS666@.discussions.microsoft.com> wrote in message
news:E43B8B5B-BBBB-4C78-BCD1-E70ED60F329C@.microsoft.com...
> Hello together,
> I tried to find out about populating an asp.net server control (a
> dropdownlist) from the clientside jscript, but I didn't find a solution
> up
> to now.
> I cannot use a html dropdownlist, because a database query in codebehind
> has
> to be done, when a new listItem is selected. So, I need to use a
> servercontrol dropdownlist.
> Now to my problem:
> I have two dropdownlists in use. One of them should show listItems that
> are
> dependent on the selection of the other one. I know that I need to use the
> clientside onchange() Event on the dropdownlistbox that decides what has
> to
> be shown in the other dropdownlist, because no postback should occur for
> this.
> The C# syntax, that is used in codebehind, doesn't work, JScript gives me
> an
> error that the object doesn't support this method.
> I can set the text and state of servercontrols like textBoxes and
> checkBoxes
> from clientside jscript with document.Form1.TextBox1..., so it should also
> be
> possible to do this with a dropdownlist too, shouldn't it?
> I tried it with Ajax.NET, but when I called a serverside function that
> should manipulate the dropdownlist, a nullpointerexception occurs, because
> all the instances of the serverside controls are "undefined" (I saw it in
> the
> debugger). I've no explanation for this, as they are created on page_Load.
> So
> I cancelled my efforts introducing Ajax into this. As the project is
> nearly
> finished, I would like to avoid using Ajax for the dropdownlist stuff.
> I hope somebody can help
> Thanks in advance
> RFS666
you need to lean the browser dom to do client script (or ajax). also if you
change the entires in a list client side, you need to send this info to the
server somehow (usually a hidden field), as the browser only posts pack the
selected value of a dropdown. you shoudl go to the bookstore and pickup a
book on javascript.
-- bruce (sqlwork.com)
"RFS666" <RFS666@.discussions.microsoft.com> wrote in message
news:E43B8B5B-BBBB-4C78-BCD1-E70ED60F329C@.microsoft.com...
> Hello together,
> I tried to find out about populating an asp.net server control (a
> dropdownlist) from the clientside jscript, but I didn't find a solution
> up
> to now.
> I cannot use a html dropdownlist, because a database query in codebehind
> has
> to be done, when a new listItem is selected. So, I need to use a
> servercontrol dropdownlist.
> Now to my problem:
> I have two dropdownlists in use. One of them should show listItems that
> are
> dependent on the selection of the other one. I know that I need to use the
> clientside onchange() Event on the dropdownlistbox that decides what has
> to
> be shown in the other dropdownlist, because no postback should occur for
> this.
> The C# syntax, that is used in codebehind, doesn't work, JScript gives me
> an
> error that the object doesn't support this method.
> I can set the text and state of servercontrols like textBoxes and
> checkBoxes
> from clientside jscript with document.Form1.TextBox1..., so it should also
> be
> possible to do this with a dropdownlist too, shouldn't it?
> I tried it with Ajax.NET, but when I called a serverside function that
> should manipulate the dropdownlist, a nullpointerexception occurs, because
> all the instances of the serverside controls are "undefined" (I saw it in
> the
> debugger). I've no explanation for this, as they are created on page_Load.
> So
> I cancelled my efforts introducing Ajax into this. As the project is
> nearly
> finished, I would like to avoid using Ajax for the dropdownlist stuff.
> I hope somebody can help
> Thanks in advance
> RFS666