Showing posts with label aspnet. Show all posts
Showing posts with label aspnet. Show all posts

Thursday, March 29, 2012

POP3 and ASP.NET

I have searched for information on accessing POP3 accounts from ASP.NET. There are a couple of mentions in the forums, advising that there are many POP3 .NET components available for free, but I can only find one free component - CSLMail (http://www.wintoolzone.com/) which was last updated April 2003.

Unfortunately the documentation for CSLMail is very limited and the two very basic examples are in C# which has me stumped because I only know VB and am very new to VB.NET (although an old hand at ASP), so I'm having trouble translating them to a VB.NET web form.

I have also read a couple of POP3 articles at www.aspalliance.com, but I'm not ready to code my own components yet and again have trouble relating the code to a web form - I just need to access a POP3 account from a simple ASP.NET web page.

Can anyone suggest additional free POP3 components, or advise of some additional articles that I could read?

Thanks in advance.Soft-Artisans has a free PoP3 component that I had used before. I dont remember if there was vb.net documentation, or how good it was but its worth a shot for you.
Thanks for your reply. My searches had already taken me to Software Artisans' web site, but unfortunately, they have withdrawn the component!

Additional suggestions are welcome.

Thanks again.
Hi amigo how is life
You have mentioned an organization but not its url can i have its url plz.
softartisans.com
Thanks Boss.

Monday, March 26, 2012

populate checkboxlist from XmlDataSource (ASP.net 2.0)

can somebody please show me some code that will let me populate a
checkboxlist from the xmldatasource, and have the text property set to the
names in the xml file
thanks
you can also email me at i_am_the_freshmaka@dotnet.itags.org.hotmail.commike <mike@.discussions.microsoft.com> ha scritto:
> can somebody please show me some code that will let me populate a
> checkboxlist from the xmldatasource, and have the text property set
> to the names in the xml file
> thanks
With this XML file:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<item value="1" text="Value 1" />
<item value="2" text="Value 2" />
<item value="3" text="Value 3" />
</root>
And this code:
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
DataSourceID="XmlDataSource1"
DataTextField="text" DataValueField="value">
</asp:CheckBoxList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Data/XMLFile.xml"></asp:XmlDataSource>
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
<Lookup>
<Lookup_Entry>
<Ts>
<T>
<M>context</M>
<V>type</V>
<Va>Citizen</Va>
</T>
</Ts>
<U>.html</U>
</Lookup_Entry>
</Lookup>
example of xml file is above
code:
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Lookup
table.xml"
XPath='/Lookup/Lookup_Entry/Ts/T/Va[../../T[M = "context" and V
= "type"]]'>
</asp:XmlDataSource>
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
DataSourceID="XmlDataSource1">
</asp:CheckBoxList>
Now how do i get each <Va> that is returned with the xmldatasource as a item
in my checkboxlist
displayed now when run is with a checkbox to the left of each item:
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
System.Web.UI.WebControls.XmlDataSourceNodeDescriptor
mike
"Andrea Zani" wrote:

> mike <mike@.discussions.microsoft.com> ha scritto:
> With this XML file:
> <?xml version="1.0" encoding="utf-8" ?>
> <root>
> <item value="1" text="Value 1" />
> <item value="2" text="Value 2" />
> <item value="3" text="Value 3" />
> </root>
> And this code:
> <asp:CheckBoxList ID="CheckBoxList1" runat="server"
> DataSourceID="XmlDataSource1"
> DataTextField="text" DataValueField="value">
> </asp:CheckBoxList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
> DataFile="~/Data/XMLFile.xml"></asp:XmlDataSource>
> --
> AZ [Microsoft - .NET MVP]
> Mia Home page: http://ciclismo.sitiasp.it
> Asp.Net community: http://www.aspitalia.com
> Il mio blog: http://blogs.aspitalia.com/az
>
>

populate checkboxlist from XmlDataSource (ASP.net 2.0)

can somebody please show me some code that will let me populate a
checkboxlist from the xmldatasource, and have the text property set to the
names in the xml file

thanks
you can also email me at i_am_the_freshmaka@dotnet.itags.org.hotmail.commike <mike@.discussions.microsoft.com> ha scritto:
> can somebody please show me some code that will let me populate a
> checkboxlist from the xmldatasource, and have the text property set
> to the names in the xml file
> thanks

With this XML file:
<?xml version="1.0" encoding="utf-8" ?>
<root>
<item value="1" text="Value 1" />
<item value="2" text="Value 2" />
<item value="3" text="Value 3" />
</root
And this code:
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
DataSourceID="XmlDataSource1"
DataTextField="text" DataValueField="value">
</asp:CheckBoxList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Data/XMLFile.xml"></asp:XmlDataSource
--
AZ [Microsoft - .NET MVP]
Mia Home page: http://ciclismo.sitiasp.it
Asp.Net community: http://www.aspitalia.com
Il mio blog: http://blogs.aspitalia.com/az
<Lookup>
<Lookup_Entry>
<Ts>
<T>
<M>context</M>
<V>type</V>
<Va>Citizen</Va>
</T>
</Ts>
<U>.html</U>
</Lookup_Entry>
</Lookup>
example of xml file is above

code:
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Lookup
table.xml"
XPath='/Lookup/Lookup_Entry/Ts/T/Va[../../T[M = "context" and V
= "type"]]'>
</asp:XmlDataSource>
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
DataSourceID="XmlDataSource1">
</asp:CheckBoxList
Now how do i get each <Va> that is returned with the xmldatasource as a item
in my checkboxlist

displayed now when run is with a checkbox to the left of each item:
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor
System.Web.UI.WebControls.XmlDataSourceNodeDescrip tor

mike

"Andrea Zani" wrote:

> mike <mike@.discussions.microsoft.com> ha scritto:
> > can somebody please show me some code that will let me populate a
> > checkboxlist from the xmldatasource, and have the text property set
> > to the names in the xml file
> > thanks
> With this XML file:
> <?xml version="1.0" encoding="utf-8" ?>
> <root>
> <item value="1" text="Value 1" />
> <item value="2" text="Value 2" />
> <item value="3" text="Value 3" />
> </root>
> And this code:
> <asp:CheckBoxList ID="CheckBoxList1" runat="server"
> DataSourceID="XmlDataSource1"
> DataTextField="text" DataValueField="value">
> </asp:CheckBoxList><asp:XmlDataSource ID="XmlDataSource1" runat="server"
> DataFile="~/Data/XMLFile.xml"></asp:XmlDataSource>
> --
> AZ [Microsoft - .NET MVP]
> Mia Home page: http://ciclismo.sitiasp.it
> Asp.Net community: http://www.aspitalia.com
> Il mio blog: http://blogs.aspitalia.com/az
>

Saturday, March 24, 2012

Populate Excell Sheet using ASP.NET/VB.NET

I have an Excel sheet that I want to be able to make changes to it
using ASP/VB.NET (like updating cells values and maybe formulas). Once
it's done; I want to save it and then launch the changed file to the
user.

How do I do that? Any examples available?"No_Spam" <no_to_spam@.comcast.netwrote in message
news:1169488289.448842.193250@.m58g2000cwm.googlegr oups.com...

Quote:

Originally Posted by

>I have an Excel sheet that I want to be able to make changes to it
using ASP/VB.NET (like updating cells values and maybe formulas). Once
it's done; I want to save it and then launch the changed file to the
user.
>
How do I do that? Any examples available?


http://www.aspose.com/Products/Aspo...ls/Default.aspx
This might be your best bet. You can open Excel as an ADO.NET data source:
http://groups.google.com/group/micr...71439ff12d7473d
Here are some other articles that may help as well:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeExcel.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"No_Spam" <no_to_spam@.comcast.netwrote in message
news:1169488289.448842.193250@.m58g2000cwm.googlegr oups.com...

Quote:

Originally Posted by

>I have an Excel sheet that I want to be able to make changes to it
using ASP/VB.NET (like updating cells values and maybe formulas). Once
it's done; I want to save it and then launch the changed file to the
user.
>
How do I do that? Any examples available?
>

Populate Excell Sheet using ASP.NET/VB.NET

I have an Excel sheet that I want to be able to make changes to it
using ASP/VB.NET (like updating cells values and maybe formulas). Once
it's done; I want to save it and then launch the changed file to the
user.
How do I do that? Any examples available?"No_Spam" <no_to_spam@.comcast.net> wrote in message
news:1169488289.448842.193250@.m58g2000cwm.googlegroups.com...

>I have an Excel sheet that I want to be able to make changes to it
> using ASP/VB.NET (like updating cells values and maybe formulas). Once
> it's done; I want to save it and then launch the changed file to the
> user.
> How do I do that? Any examples available?
http://www.aspose.com/Products/Aspo...ls/Default.aspx
This might be your best bet. You can open Excel as an ADO.NET data source:
http://groups.google.com/group/micr...71439ff12d7473d
Here are some other articles that may help as well:
http://SteveOrr.net/articles/ExcelExport.aspx
http://SteveOrr.net/articles/ExportPanel.aspx
http://SteveOrr.net/reviews/AsposeExcel.aspx
http://SteveOrr.net/reviews/OfficeWriter.aspx
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"No_Spam" <no_to_spam@.comcast.net> wrote in message
news:1169488289.448842.193250@.m58g2000cwm.googlegroups.com...
>I have an Excel sheet that I want to be able to make changes to it
> using ASP/VB.NET (like updating cells values and maybe formulas). Once
> it's done; I want to save it and then launch the changed file to the
> user.
> How do I do that? Any examples available?
>

Friday, March 16, 2012

populating an access database used for ASP.net website...

I want to populate my access database with strings which are coded as
follows:

{
{"string1"},
{"string2"},
{"string3"},
.....
{"string100"},
{"string101"},
}

I have 200 of these string lists that I want to populate an access data
base. I am building a website using ASP.net.

Without having to copy and paste each string individually, is there
anything I could do that would be simpler and faster?

Thanks,
RABMissouriDo each of these strings belong in the same field (ie: one row per string) or
the same row (one field per row).

The first is safer for what I'm about to describe, because then you don't
have to worry about the data matching up, but either is fine.

You can write something like:
int i = 0;
foreach(string strValue in array)
{
this.AddValue(strValue);
//dSet[0][i] = strValue;
//i++;
}
//this.UpdateData(dSet);

Hope that helps,

Jason Lind

"RAB" wrote:

> I want to populate my access database with strings which are coded as
> follows:
>
> {
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
> }
> I have 200 of these string lists that I want to populate an access data
> base. I am building a website using ASP.net.
> Without having to copy and paste each string individually, is there
> anything I could do that would be simpler and faster?
> Thanks,
> RABMissouri
>
"RAB" wrote:
>I want to populate my access database with strings which are coded as
>follows:
>
>{
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
>}
>I have 200 of these string lists that I want to populate an access data
>base. I am building a website using ASP.net.
>Without having to copy and paste each string individually, is there
>anything I could do that would be simpler and faster?
>Thanks,
>RABMissouri

you can always create a for cicle to do that

for x=0 to 200
insert "string" & x
next

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Is this code using VB?

Would you sample code be part of the SQL statement?

Thanks,
RABMissouri

MamaKike wrote:
> "RAB" wrote:
> >I want to populate my access database with strings which are coded as
> >follows:
> >{
> > {"string1"},
> > {"string2"},
> > {"string3"},
> > .....
> > {"string100"},
> > {"string101"},
> >}
> >I have 200 of these string lists that I want to populate an access data
> >base. I am building a website using ASP.net.
> >Without having to copy and paste each string individually, is there
> >anything I could do that would be simpler and faster?
> >Thanks,
> >RABMissouri
> you can always create a for cicle to do that
> for x=0 to 200
> insert "string" & x
> next
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
I'm going to try to put an example

Imagine that you have a database table named xpto with only a field
named exp. And you want to write in exp your strings
string1...string200

dim dtaConnection as New SqlConnection("integrated security=SSPI;data
source=(local);persist security info=False;initial catalog=xpto")
dim strSql as string
Dim comand As New SqlCommand(strSQL, dtaConnection)
comand.CommandType = CommandType.Text

dtaConnection.Open()
for i as integer=0 to 200
sql="Insert into exp values (" & i &")"
comand.ExecuteNonQuery()
next
dtaConnection.Close()

to use oledb change SQL to oledb

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

populating an access database used for ASP.net website...

I want to populate my access database with strings which are coded as
follows:
{
{"string1"},
{"string2"},
{"string3"},
....
{"string100"},
{"string101"},
}
I have 200 of these string lists that I want to populate an access data
base. I am building a website using ASP.net.
Without having to copy and paste each string individually, is there
anything I could do that would be simpler and faster?
Thanks,
RABMissouriDo each of these strings belong in the same field (ie: one row per string) o
r
the same row (one field per row).
The first is safer for what I'm about to describe, because then you don't
have to worry about the data matching up, but either is fine.
You can write something like:
int i = 0;
foreach(string strValue in array)
{
this.AddValue(strValue);
//dSet[0][i] = strValue;
//i++;
}
//this.UpdateData(dSet);
Hope that helps,
Jason Lind
"RAB" wrote:

> I want to populate my access database with strings which are coded as
> follows:
>
> {
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
> }
> I have 200 of these string lists that I want to populate an access data
> base. I am building a website using ASP.net.
> Without having to copy and paste each string individually, is there
> anything I could do that would be simpler and faster?
> Thanks,
> RABMissouri
>
"RAB" wrote:
>I want to populate my access database with strings which are coded as
>follows:
>
>{
> {"string1"},
> {"string2"},
> {"string3"},
> .....
> {"string100"},
> {"string101"},
>}
>I have 200 of these string lists that I want to populate an access data
>base. I am building a website using ASP.net.
>Without having to copy and paste each string individually, is there
>anything I could do that would be simpler and faster?
>Thanks,
>RABMissouri
>
you can always create a for cicle to do that
for x=0 to 200
insert "string" & x
next
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Is this code using VB?
Would you sample code be part of the SQL statement?
Thanks,
RABMissouri
MamaKike wrote:
> "RAB" wrote:
> you can always create a for cicle to do that
> for x=0 to 200
> insert "string" & x
> next
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
I'm going to try to put an example
Imagine that you have a database table named xpto with only a field
named exp. And you want to write in exp your strings
string1...string200
dim dtaConnection as New SqlConnection("integrated security=SSPI;data
source=(local);persist security info=False;initial catalog=xpto")
dim strSql as string
Dim comand As New SqlCommand(strSQL, dtaConnection)
comand.CommandType = CommandType.Text
dtaConnection.Open()
for i as integer=0 to 200
sql="Insert into exp values (" & i &")"
comand.ExecuteNonQuery()
next
dtaConnection.Close()
to use oledb change SQL to oledb
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Populating DIV tag from javascript via ASP.Net & ClientScript methods

I'm trying to run some clientside javascript on page load for one of my
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.

David Mathew
mathewda@dotnet.itags.org.gmail.comusing masterpages? if so, it changes the client ID

Dave Mathew wrote:

Quote:

Originally Posted by

I'm trying to run some clientside javascript on page load for one of my
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.
>
David Mathew
mathewda@.gmail.com


I think what you are running into is the javascript code being executed
before the elements of your page have been created in the page DOM.
Try to stick your javascript into the onload attribute of your body tag
and see if it will work.

If this does work, I think what you will have to do is register your
javascript with the onload event either by adding it as an attribute of
the body tag or via external script.

http://www.quirksmode.org/js/events_advanced.html
The above article is similar to what you could use to register your
javascript with the load event except of course the event you want to
register for is load (onload in IE) and I believe you want to use
window as your element.

I wrote a javascript register function that handles cross browser
registration a while ago but don't have it with me. Let me know if you
want it and I'll post it. I believe there are also similar examples
out there somewhere on the web.

Clint.

Dave Mathew wrote:

Quote:

Originally Posted by

I'm trying to run some clientside javascript on page load for one of my
ASP.Net pages. I am using the ClientScript.RegisterClient...() methods
to register an external javascript file within ASP.Net. When I put my
code on a ASP button and click it it works just find, runs my
javascript which popus up an alert and then changes the div text.
However, when I put this on a Page_Load event the alert comes up ok but
the changing of the div text does not occur. I have a feeling this has
something to do with not all the page elements being rendered or
avaiable in some way to the javascript. I've tried placing the code in
LoadComplete, and Init, with the same results. Any suggestions on how I
can get my javascript code to be triggered on page load from ASP and be
able to access page elements like div tags? I don't have my code in
front of me now but could come up with example if needed. Any advice is
appreciated.
>
David Mathew
mathewda@.gmail.com

populating dropdownlist (asp.net server ctrl) from clientside jscr

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

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

populating dropdownlist (asp.net server ctrl) from clientside jscr

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 thi
s.
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 b
e
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 th
e
debugger). I've no explanation for this, as they are created on page_Load. S
o
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 u
p
> to now.
> I cannot use a html dropdownlist, because a database query in codebehind h
as
> 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 ar
e
> 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 t
o
> be shown in the other dropdownlist, because no postback should occur for t
his.
> 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 checkBox
es
> 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 nearl
y
> 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/...me
=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