Saturday, March 31, 2012
Server Side Controls in ASP.NET
I have an aspx page with some server side textboxes.
I have a button onmy page which allows users to add data
to a database.
In my onclick event for my button when I try and get teh
value from the textbox using..
Dim myString as String = textbox1.text
...it is blank.
When I do a..
Dim myString = Request.Form("textbox1")
...I get the value the user enetered.
I have declared my textbox as a control in my codebehind.
And it is an asp.net textbox.
Any ideas why this is?
This is baffling me.
Kerri.Have you added the "runat=server" attribute to the template HTML for the
text box?
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
"Kerri" <anonymous@.discussions.microsoft.com> wrote in message
news:017401c39cc4$12c55070$a501280a@.phx.gbl...
> Hi,
> I have an aspx page with some server side textboxes.
> I have a button onmy page which allows users to add data
> to a database.
> In my onclick event for my button when I try and get teh
> value from the textbox using..
> Dim myString as String = textbox1.text
> ..it is blank.
> When I do a..
> Dim myString = Request.Form("textbox1")
> ..I get the value the user enetered.
> I have declared my textbox as a control in my codebehind.
> And it is an asp.net textbox.
> Any ideas why this is?
> This is baffling me.
> Kerri.
Server Side FieldSet?
I'm trying to write a Web Custom control that allows me to generate a set of server side text boxes inside the fieldset element. What I have is this:
protectedoverridevoid Render(HtmlTextWriter output){
StringBuilder sb =new StringBuilder();//Begin the FieldSet if it's needed
if (this.ShowBorder )sb.Append(string.Format("<fieldset style='WIDTH: {0}; HEIGHT: {1}'><legend>{2}</legend>",this.Width,this.Height,this.Legend));
//Add user controls
for(int i = 0; i <this.SearchFormFields.Length; i++){
SearchField curField =this.SearchFormFields[i];sb.Append(string.Format("<span class='fwifont'>{0}</span><br>", curField.Title));
//sb.Append(string.Format("<FWI:MultiRangeTextBox CssClass='fwifont' id=AccountNumberBox runat='server' TermName='{0}'></FWI:MultiRangeTextBox>", curField.TermName));
sb.Append("<asp:TextBox Runat='server' ID='fsdfd'></asp:TextBox>");
}
sb.Append("<br>");
//Finish off fieldset
if (this.ShowBorder )sb.Append("</fieldset>");
sb.Append("<br>");
output.Write(sb.ToString());
}
However, the asp:text box does not render or show up. I'm guessing this has something to do with the fact that it's a server side control itself. Does anyone have any ideas on what I'm doing wrong here?
You are trying to output ASP control tags as markup. Would something like "<input type="text" id=......" rather the the ASP textbox control be more suitable?
Ta
Most unfortuantely, no, I cannot use html input fields. And actually, it not only needs to be a server side control, in reality it should be a custom web control that actually extends the asp:textbox class. I have a method that traverses all the controls on the web forms and handles the input of each textbox based on what "type" of server side text box it is.
Monday, March 26, 2012
Server Side Word Application
that allows me to print specific documents from the server
im using:
Dim wordapp = New Word.Application
and have added the word reference (and installed word on the server)
the problem i have is that when i run the above code i get an:
Access is denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
any help with this would be greatly appreciated as ive hit a brick wall with
things to try
thanks in advance
Mike FellowsIf you know the doc name and the location of the doc why open word, just
send the doc to the printer?
I'm doing the exact same thing but with PDF docs using BizTalk
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> wrote in message
news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> I'm trying to create a server side application (through a web front end)
> that allows me to print specific documents from the server
> im using:
> Dim wordapp = New Word.Application
> and have added the word reference (and installed word on the server)
> the problem i have is that when i run the above code i get an:
> Access is denied.
> Description: An unhandled exception occurred during the execution
of
> the current web request. Please review the stack trace for more
information
> about the error and where it originated in the code.
> any help with this would be greatly appreciated as ive hit a brick wall
with
> things to try
> thanks in advance
> Mike Fellows
>
I cant do that as i need to edit some bookmarks within the word document
otherwise it would be great
Mike Fellows
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:uQpDFXKSEHA.1216@.TK2MSFTNGP10.phx.gbl...
> If you know the doc name and the location of the doc why open word, just
> send the doc to the printer?
> I'm doing the exact same thing but with PDF docs using BizTalk
>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> wrote in message
> news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
execution
> of
> information
> with
>
You can create ActiveX word object on client side and manipulate the bookmar
ks.
I just had the same with Excel.
I think that the solution is just to add a web.config file in the same
folder as your aspx with the code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<identity impersonate="true"/>
</system.web>
</configuration>
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le message
de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> I'm trying to create a server side application (through a web front end)
> that allows me to print specific documents from the server
> im using:
> Dim wordapp = New Word.Application
> and have added the word reference (and installed word on the server)
> the problem i have is that when i run the above code i get an:
> Access is denied.
> Description: An unhandled exception occurred during the execution
of
> the current web request. Please review the stack trace for more
information
> about the error and where it originated in the code.
> any help with this would be greatly appreciated as ive hit a brick wall
with
> things to try
> thanks in advance
> Mike Fellows
>
Thanks
i will give that a goo
Mike Fellows
"Franky" <fnappey@.lcf-com.removethis.com> wrote in message
news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> I just had the same with Excel.
> I think that the solution is just to add a web.config file in the same
> folder as your aspx with the code:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <system.web>
> <identity impersonate="true"/>
> </system.web>
> </configuration>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le
message
> de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
execution
> of
> information
> with
>
Bin,
could you point me to a document explaining how to do this client side?
Thanks
Mike
"Bin Song, MCP" <anonymous@.discussions.microsoft.com> wrote in message
news:00924C08-9A8B-4A6C-B5E9-A1F58677A23A@.microsoft.com...
> You can create ActiveX word object on client side and manipulate the
bookmarks.
Franky,
this then opens word on the server, but it seems impossible to manipulate
i cant even set the word object to visible
Thanks
Mike
"Franky" <fnappey@.lcf-com.removethis.com> wrote in message
news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> I just had the same with Excel.
> I think that the solution is just to add a web.config file in the same
> folder as your aspx with the code:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <system.web>
> <identity impersonate="true"/>
> </system.web>
> </configuration>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le
message
> de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
execution
> of
> information
> with
>
Please see:
HOWTO: Automate Excel from an HTML Web Page Using JScript
http://support.microsoft.com/defaul...kb;en-us;234774
Yes, I got the same problem with Excel.
The only solution I find (for Excel) is to install Excel 2003 instead of
Excel XP. And I posted a news concerning Excel XP...
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le message
de news:xEmvc.37$An.15@.newsfe6-win...
> Franky,
> this then opens word on the server, but it seems impossible to manipulate
> i cant even set the word object to visible
> Thanks
> Mike
>
> "Franky" <fnappey@.lcf-com.removethis.com> wrote in message
> news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> message
end)
> execution
wall
>
Server Side Word Application
that allows me to print specific documents from the server
im using:
Dim wordapp = New Word.Application
and have added the word reference (and installed word on the server)
the problem i have is that when i run the above code i get an:
Access is denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
any help with this would be greatly appreciated as ive hit a brick wall with
things to try
thanks in advance
Mike FellowsIf you know the doc name and the location of the doc why open word, just
send the doc to the printer?
I'm doing the exact same thing but with PDF docs using BizTalk
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> wrote in message
news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> I'm trying to create a server side application (through a web front end)
> that allows me to print specific documents from the server
> im using:
> Dim wordapp = New Word.Application
> and have added the word reference (and installed word on the server)
> the problem i have is that when i run the above code i get an:
> Access is denied.
> Description: An unhandled exception occurred during the execution
of
> the current web request. Please review the stack trace for more
information
> about the error and where it originated in the code.
> any help with this would be greatly appreciated as ive hit a brick wall
with
> things to try
> thanks in advance
> Mike Fellows
I cant do that as i need to edit some bookmarks within the word document
otherwise it would be great
Mike Fellows
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:uQpDFXKSEHA.1216@.TK2MSFTNGP10.phx.gbl...
> If you know the doc name and the location of the doc why open word, just
> send the doc to the printer?
> I'm doing the exact same thing but with PDF docs using BizTalk
>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> wrote in message
> news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> > I'm trying to create a server side application (through a web front end)
> > that allows me to print specific documents from the server
> > im using:
> > Dim wordapp = New Word.Application
> > and have added the word reference (and installed word on the server)
> > the problem i have is that when i run the above code i get an:
> > Access is denied.
> > Description: An unhandled exception occurred during the
execution
> of
> > the current web request. Please review the stack trace for more
> information
> > about the error and where it originated in the code.
> > any help with this would be greatly appreciated as ive hit a brick wall
> with
> > things to try
> > thanks in advance
> > Mike Fellows
You can create ActiveX word object on client side and manipulate the bookmarks.
I just had the same with Excel.
I think that the solution is just to add a web.config file in the same
folder as your aspx with the code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<identity impersonate="true"/>
</system.web>
</configuration
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le message
de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> I'm trying to create a server side application (through a web front end)
> that allows me to print specific documents from the server
> im using:
> Dim wordapp = New Word.Application
> and have added the word reference (and installed word on the server)
> the problem i have is that when i run the above code i get an:
> Access is denied.
> Description: An unhandled exception occurred during the execution
of
> the current web request. Please review the stack trace for more
information
> about the error and where it originated in the code.
> any help with this would be greatly appreciated as ive hit a brick wall
with
> things to try
> thanks in advance
> Mike Fellows
Thanks
i will give that a goo
Mike Fellows
"Franky" <fnappey@.lcf-com.removethis.com> wrote in message
news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> I just had the same with Excel.
> I think that the solution is just to add a web.config file in the same
> folder as your aspx with the code:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <system.web>
> <identity impersonate="true"/>
> </system.web>
> </configuration>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le
message
> de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> > I'm trying to create a server side application (through a web front end)
> > that allows me to print specific documents from the server
> > im using:
> > Dim wordapp = New Word.Application
> > and have added the word reference (and installed word on the server)
> > the problem i have is that when i run the above code i get an:
> > Access is denied.
> > Description: An unhandled exception occurred during the
execution
> of
> > the current web request. Please review the stack trace for more
> information
> > about the error and where it originated in the code.
> > any help with this would be greatly appreciated as ive hit a brick wall
> with
> > things to try
> > thanks in advance
> > Mike Fellows
Bin,
could you point me to a document explaining how to do this client side?
Thanks
Mike
"Bin Song, MCP" <anonymous@.discussions.microsoft.com> wrote in message
news:00924C08-9A8B-4A6C-B5E9-A1F58677A23A@.microsoft.com...
> You can create ActiveX word object on client side and manipulate the
bookmarks.
Franky,
this then opens word on the server, but it seems impossible to manipulate
i cant even set the word object to visible
Thanks
Mike
"Franky" <fnappey@.lcf-com.removethis.com> wrote in message
news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> I just had the same with Excel.
> I think that the solution is just to add a web.config file in the same
> folder as your aspx with the code:
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <system.web>
> <identity impersonate="true"/>
> </system.web>
> </configuration>
> "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le
message
> de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> > I'm trying to create a server side application (through a web front end)
> > that allows me to print specific documents from the server
> > im using:
> > Dim wordapp = New Word.Application
> > and have added the word reference (and installed word on the server)
> > the problem i have is that when i run the above code i get an:
> > Access is denied.
> > Description: An unhandled exception occurred during the
execution
> of
> > the current web request. Please review the stack trace for more
> information
> > about the error and where it originated in the code.
> > any help with this would be greatly appreciated as ive hit a brick wall
> with
> > things to try
> > thanks in advance
> > Mike Fellows
Please see:
HOWTO: Automate Excel from an HTML Web Page Using JScript
http://support.microsoft.com/defaul...kb;en-us;234774
Yes, I got the same problem with Excel.
The only solution I find (for Excel) is to install Excel 2003 instead of
Excel XP. And I posted a news concerning Excel XP...
"Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le message
de news:xEmvc.37$An.15@.newsfe6-win...
> Franky,
> this then opens word on the server, but it seems impossible to manipulate
> i cant even set the word object to visible
> Thanks
> Mike
>
> "Franky" <fnappey@.lcf-com.removethis.com> wrote in message
> news:uH7TLyKSEHA.3944@.TK2MSFTNGP11.phx.gbl...
> > I just had the same with Excel.
> > I think that the solution is just to add a web.config file in the same
> > folder as your aspx with the code:
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > <system.web>
> > <identity impersonate="true"/>
> > </system.web>
> > </configuration>
> > "Mike Fellows" <mike.fellows.SPAM@.equityhouse.co.uk> a crit dans le
> message
> > de news:nplvc.52$1d7.29@.newsfe3-win.server.ntli.net...
> > > I'm trying to create a server side application (through a web front
end)
> > > > that allows me to print specific documents from the server
> > > > im using:
> > > > Dim wordapp = New Word.Application
> > > > and have added the word reference (and installed word on the server)
> > > > the problem i have is that when i run the above code i get an:
> > > > Access is denied.
> > > Description: An unhandled exception occurred during the
> execution
> > of
> > > the current web request. Please review the stack trace for more
> > information
> > > about the error and where it originated in the code.
> > > > any help with this would be greatly appreciated as ive hit a brick
wall
> > with
> > > things to try
> > > > thanks in advance
> > > > Mike Fellows
> >