|
Further to the first post, I can actually make the page show now by refreshing (F5) when the "Page cannot be displayed" message is shown, although the text I input is not shown. In my Parse Map I have included a default (~) in case the text box is empty when the Submit button is pressed. This is being displayed so my handler function must be working OK.
My Parse Map now looks like this:
BEGIN_PARSE_MAP(CISAPI002Extension, CHttpServer)
ON_PARSE_COMMAND(Default, CISAPI002Extension, ITS_PSTR)
ON_PARSE_COMMAND_PARAMS("Input=~")
ON_PARSE_COMMAND(InputText, CISAPI002Extension, ITS_PSTR)
ON_PARSE_COMMAND_PARAMS("Input=~")
DEFAULT_PARSE_COMMAND(Default, CISAPI002Extension)
END_PARSE_MAP(CISAPI002Extension)
and it is being called with the following HTML:
<FORM ACTION="http://myServer/Scripts2/ISAPI002.dll?InputText?" METHOD="POST" >
<p>Enter Text : <input name="Text" size="12" tabindex="1"></p>
<p><input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></p>
</FORM>
Any ideas???
code dope.
|
|
|
|
|
How can I change the place of a control (for example textbox) in the page programmicaly?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
If you are using ASP.NET TextBox control then *I believe* you can use its style property (I have not done that, yet).
omkamal
|
|
|
|
|
In web application when you put a control in one place then
you can't change the place or size of it and all of them are fixed?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Mazdak wrote:
you can't change the place or size of it
I dont think so. Just try to create an example like this...
Create an <asp:label id="TestLabel">. Then in your code-behind page you can always do the following...
TestLabel.Style["Top"] = "200px"; //or whatever value you want to use...
This will certainly work. Nonetheless, I am not sure about a TextBox.
omkamal
|
|
|
|
|
Simply add the control to the Controls collection of a different control on the page.
|
|
|
|
|
Andy Smith wrote:
Simply add the control to the Controls collection of a different control on the page.
Sorry could you be more specific?I didn't get it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Well, I guess it depends on what you mean by "place of a control".
If you mean moving it a few pixels to the left or right or something, then use the Left and Top properties.
If you want the control to be in a different place in the page structure, then add your control to the Controls collection of a different, container control. A good one to use for this purpose is the PlaceHolder control. It would look something like this:
TextBox myTextBox = new TextBox();
myPlaceHolder.Controls.Add( myTextBox );
|
|
|
|
|
I have a DataGrid in asp.net form,It connected to a database,and I overriden PageIndexChange of it.Each time I click the next,the hieght of grid change but the position of another controls in the form does not change so all controls go into each other position.What property or event
should I use for datagrid to solve this problem?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi everyone. I need to do the following but have been unable. I was wondering if anyone can point me in the right direction.
Something like this in the aspx :
<asp:linkbutton id="bla" runat="server">
<%= getLinkText("bla") %>
or
<asp:linkbutton id="bla" runat="server" text="<%= getLinkText(" bla")="" %="">" />
"getLinkText" is a method define in the codebehind class that returns a string with the text the link should display.
Neither of these work. Is there anyway to make this possible ?
TIA
Marco Cunha
|
|
|
|
|
In the page load event on your code behind couldn't you just say myLinkButton.Text = getLinkText("bla") ?
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
I am not 100% sure what you are actually trying to do but here are a few solutions which may help you.
For some odd reason I also cannot define a variable in my Code Behind file and then use it in the aspx, still trying to figure that one out.
But what you can do is use a Label control and set the Label controls Text property to getLinkText("bla"). The Label control just outputs whatever you put in really, does not have any begin or end Tags.
However if you need the getLinkText("bla") result to be the HREF of an A Tag then use the Hyperlink Webform control. Then you can reference it from your Code Behind code easily.
If you fill us in on what you are actually trying to achieve then maybe we can help more
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
Paul Watson wrote:
For some odd reason I also cannot define a variable in my Code Behind file and then use it in the aspx, still trying to figure that one out.
What were you trying to do with it? From what I can tell the code behind uses elements from the ASPX, if those aren't present then the new element needs to be added to the Page's Controls collection.
Is my thinking really far off from what you were trying?
James
Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978
|
|
|
|
|
James T. Johnson wrote:
What were you trying to do with it?
I started typing a reply to you, explaining my problem and what I was trying to do. I even put some code into explain it well...
Then it twigged. Your words "needs to be added to the Page's Controls collection" made me think "Hang on, if I declare a string in the Page class, then maybe I can access it in the ASPX file..." and it worked!
Woohooo, so you solved my problem. Thanks James.
FYI for anyone interested here is the problem and solution:
Initially in my ASPX file I had:
...
<head>
<%string strPageTitle = "Page Editor";%>
<title>Numerica - <%Response.Write(strTest);%></title>
</head>
...
(I used the strPagetitle for other things if you were wondering why I went to all that trouble)
However I wanted to declare that strPageTitle variable in the ASPX.CS (code behind) file, not in the ASPX file. I could not figure it out until James here helped. And this is the solution.
ASPX.CS file:
public class pagemanager : System.Web.UI.Page
{
protected System.String strTest;
private void Page_Load(object sender, System.EventArgs e)
{
strPageTitle = "Page Manager";
}
...
And with that I could reference strPageTitle in my ASPX file just fine.
Woohoo! Ta James, you opened my eyes a bit more to how the whole ASP.NET model works.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
I ended up using the Page_Load event to load the LinkButton text like had been suggested.
I'm creating a user web control and needed the ability to let the user configure the link text to whatever he wanted (making localization possible).
Thanks for your replies guys,
Marco Cunha
|
|
|
|
|
I have a form that sends data to a Access Databse. and everything works great. When I click on the submit button, it clears the form and allows me to add another record. I want to have a few fields retain the same data from the previous record. My main question is, should I be doing this with a cookie?
|
|
|
|
|
A cookie is one way, but anyone who has cookies disabled in the browser would be unable to use it, or be forced to put your website in a more trusted zone (where cookies are enabled). A simpler method would be to use hidden fields on the form. When the form is posted, the same fields could be resent to the client as part of the new blank record. If this is user-type information, for instance, the hidden fields could be initialized at the session level to reset them for each user.
|
|
|
|
|
kashmir9999 wrote:
want to have a few fields retain the same data from the previous record. My main question is, should I be doing this with a cookie?
You could do it with a cookie but that probably is not the best way.
Here is how I would do it (and I am assuming you are using ASP, not ASP.NET, if not then just message back and I will show you how in ASP.NET):
<%@ Language=VBScript %>
<%Option Explicit%>
<%
Dim strNameFirst, strNameLast, dtmDateOfBirth
strNameFirst = Request.Form("txtNameFirst")
strNameLast = Request.Form("txtNameLast")
dtmDateOfBirth = Request.Form("txtDateOfBirth")
'- Now do your database code to save the record, but only if there is something to save
If Request.QueryString("mode") = "save" Then
'- save to db
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<link rel="Stylesheet" href="main.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<form name="frmPerson" method="post" action="tet.asp?mode=save">
<table>
<tr>
<td align="right">First Name:</td>
<td><input type="text" name="txtNameFirst" value="<%=strNameFirst%>" /></td>
</tr>
<tr>
<td align="right">Last Name:</td>
<td><input type="text" name="txtNameLast" value="<%=strNameLast%>" /></td>
</tr>
<tr>
<td align="right">Date of Birth:</td>
<td><input type="text" name="txtDateOfBirth" value="" /></td>
</tr>
<tr>
<td align="right" colspan="2"><input type="submit" value="Save & Proceed" /></td>
</tr>
</table>
</form>
</body>
</html>
So basically when the page loads the first time it tries to retrieve the values of txtNameFirst and txtNameLast from the form POST data. However because this is the first time there is no data, but no worries because no error will be raised.
It then ensures that you don't save any new blanl records to the dB with the If.
Then the HTML and form is returned, if there is a value in the strNameFirst or strNameLast variables then they are shown in the text boxes, if not, then nothing is shown in the text boxes. Once again, no error if blank.
When you submit the form it does this all again but this time with values in the text boxes it can "retain state" and show what was typed in last time.
If you want default values then you can init the variables with a default value.
One nice thing about ASP.NET is that it does this kind of thing automatically! So swap to ASP.NET
Good luck Kashmir9999
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Sonork ID: 100.9903 Stormfront
|
|
|
|
|
Does anyone know of any resources that compare the .NET framework with J2EE.
I'm interested in examples of which is more robust and scalable etc.
TIA.
Dave.
|
|
|
|
|
Unable to get syntax highlightning and command-completion to work in VS.NET with a regular *.aspx page
Anyone have any tips on how to accomplish this?! I tried to create a forms-page and separated the code to the file.aspx.cs-source, but it appears i manually have to compile the file and also get 2 files per page (*.aspx and *.aspx.cs).
..Mats
|
|
|
|
|
vs.net only supports intellisense with the codebehind model.
|
|
|
|
|
Anonymous wrote:
vs.net only supports intellisense with the codebehind model
That really sucks!
It makes regular aspx-editing a pain in the ass. Just hope there is a way around it and/or they fix it in the first service-pack.
|
|
|
|
|
I have a DataGrid in the web form,in Page_Load I bind it to a datasource.This database is very larg so I make the PageStyle availabe,when I run my form,
the first five rows appeare but if I click the next in pagerstyle nothing happend and it doesn't show next records.Should I add any code for this feature?
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Yes, you have to handle the OnPageIndexChanged Event and bind the data again with setting the CurrentPageIndex property to the selected page index.
See, OnPageIndexChanged Event help in MSDN documentation. They have a sample also.
omkamal
|
|
|
|
|
Thanks
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|