|
Hi there,
You simply set the CausesValidation property of the button to false to make sure that all the validators will be ignored when you press the button.
|
|
|
|
|
Hi minhpc_bk.
Thanks for your help, the solution works. Again thanks a lot. As an alternative, I did actually saw a block of javascript solution for my problem mentioned earlier, but unfortunately I lost it. If you have the Javascript solution, please do tell me.
Thanks again.
|
|
|
|
|
Alternatively, you can use the javascript to disable all the validators stored in the Page_Validators array, and this script is registered to the onclick event of the web server button. I'm not sure it's that what you saw earlier.
|
|
|
|
|
is there a way to do this? I have a data capturing program that I'm writing where we host our own webbrowser object on a vb form. when the user submits info on a specified page, the info is also saved in the legacy sql server database. there's validation that we can impose for the sql server stuff, but the rest of the validation is done through javascript on the page. Is there a way to access the values of javascript variables through the webbrowser object so that my app can know whether or not it validated through their checks also. we only want the stuff saved in the sql server database if it validates through their javascript code also. any help is appreciated
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Hi there,
IMO, you are not able to directly access a javascript variable through the webbrowser object, however, with the webbrowser control you basically can access all html elements on the web page. So you can save the value of a javascript variable in a hidden element, then you can retrieve the hidden element via the webbrowser object. One more thing that you also need to specify when the application can access the hidden element. The sample code below demonstrares how to get the value of a hidden element when the button is clicked:
....
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event iEvent = (mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onclick += new mshtml.HTMLDocumentEvents2_onclickEventHandler(iEvent_onclick);
...
private bool iEvent_onclick(mshtml.IHTMLEventObj e)
{
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.IHTMLInputHiddenElement hidden = (mshtml.IHTMLInputHiddenElement)doc.getElementById("hiddenID");
MessageBox.Show("Value: " + hidden.value);
return true;
}
|
|
|
|
|
Thanks. But the problem is that we aren't able to change the web page because it's made by a third party, so we can't add hidden elements to the page (or any elements, for that matter). The user has to put client info into a state database through their website, and they used to have to put all that same info into their own database. our program just captures it before it's submitted so that they don't have to input the data twice. we don't have any control over how the website is made.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Somehow I missed the IHTMLWindow2::execScript[^] method which is able to execute the specified script. To query the value of a global variable, you can provide some script to perisist the value of the global variable somewhere for example the clipboard of the window object or any other properties:
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.IHTMLWindow2 win = doc.parentWindow;
object obj = win.execScript("window.clipboardData.setData(\"Text\",Page_IsValid.toString());","javascript");
mshtml.IHTMLWindow3 win3 = (mshtml.IHTMLWindow3)doc.parentWindow;
object pageIsValid = win3.clipboardData.getData("Text");
|
|
|
|
|
May be they dosen't provide the permission to write to that directory?
|
|
|
|
|
Dear group,
I am using the webBrowser's control as part of my project, i am wondering if there is a method in the Internet Explorer's API which identifies if an element is visible or not.
Supposingly you have got a website where scrolling is needed, that is if you want to read all the web page's content you will need to scroll down to see the rest of the web page. My question is:
Is there a method which tells you if (for example, an image) is visible on the screen or whether it is not ???
Please this is very important in my project, can anyone help !
Thank you
Adam
|
|
|
|
|
Well..
You can check the size of the window and then check the position of the image.
Note however that the position of the image is reltive to the child element if that has the attribute position: set to "realtive" or "absolute".
Yea.. and you have to check how much the window has scrolled also...
<br />
The functions to use are:<br />
document.body.offsetWidth<br />
document.body.offsetHeight<br />
<br />
<object>.offsetLeft<br />
<object>.offsetTop<br />
<object>.scrollLeft<br />
<object>.scrollTop<br />
<object>.style.pixelLeft<br />
<object>.style.pixelTop<br />
By the way, these are the Explorer specific functions...
/M
|
|
|
|
|
Thanx for the advice Mattias,
but i still have a problem,
thats part of my code;
CComQIPtr<ihtmlelement2,&iid_ihtmlelement2> element(pDis);
long scrollTop;
element->get_scrollTop(&scrollTop);
Once I print scrollTop, the result is always 0 !!!
Do you have got any idea why this is happening ???
thanx in advance
Adam
|
|
|
|
|
There is a form in a html file.
Several controls , such as textbox, radiobutton, dropdown menu in the form.
All the values of the controls are needed.
How to check the values before invoke the submit button?
Thanks!
|
|
|
|
|
Hi:
You need to use a JavaScript which is wired up to onSubmit of the form and check in that function.
If all passes, return (true) to enable the browser go ahead with the form submission, else display a suitable message to the user and return (false) to request the browser to abort form submission.
Did this help you?
Deepak Kumar Vasudevan
Personal Web: http://vdeepakkumar.netfirms.com/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
hi there , can a jsp page use 2 servlets or can a jsp page consists of 2 sql statemets. my database is postgres and server is tomcat ...
sql statements are the same as ms access ...
|
|
|
|
|
1. Why use servlets when you are using JSP??
2. Yes, you can use how many SQL-statements you like from a JSP-page. However. I recomend you to create java-beans to do this. Makes your code more general and easier to maintain.
3. Servers shouldn't matter... in this case...
/M
|
|
|
|
|
I have the following so far:
preg_replace('/href=("|\').+(\.htm|l)("|\')/', 'href="${5}"', $buffer);
I am trying to find all HREF attributes which link to HTML or HTM files...which it does nicely...
But then, I am trying to replace what was found, with what was found, except I want to prepend and 'underscore' to the file name...
So...
index.html
Would become:
_index.html
Please ignore the madess behind my reasons I just need the answer
If you know what i'm doing wrong mostly in the replacement part...I would really appreciate your help...
Merci Buckets
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Just starting to familiarize myself with dotNet web design, and don't understand the behavior I'm getting with a Web Custom Control. To play around with custom controls, I decided to build a web site navigation control built around a table that's populated with the logo, and the common links in the web site. Then I just insert this control at the top of each page in the site, set one of the properties to indicate which link should be deactivated, and I've got a nice easy to maintain navigation control.
The funny behavior I get is when I set one of the controls properties in the designer... For some reason, all the rows and columns I added to the custom control in the constructor are duplicated in code on the form the control is in! What's that all about?
If that's not enough detail, here's a brief description of how I built the control... I added a web control project to my solution, and modified the template to use WebControls.Table as the base class. Then (here's where I might be going wrong) in the constructor, I added the rows and columns I wanted my control to have, and I also added the navigation links.
To use the control, I add it to the toolbox, and drag it onto the form I want to use it on. Then I have to set a property that deactivates the link for the current form, and for some reason, code is added to the form that duplicates the rows and columns I added in the constructor of the control!
|
|
|
|
|
Hi there,
That is because the Table.Rows property is defined as an inner default property of the Table class and the value of the Rows property is persisted in design mode when the control is changed. So after the control has been changed, the control designer TableDesigner redraws the appearance of the table, the rows property is now updated with the added rows in the constructor and it results in the duplication as you are seeing. In this case, you need to create your own custom control designer, the sample code looks something like:
[Designer(typeof(CustomTableDesigner))]
public class WebNavigator : System.Web.UI.WebControls.Table
{
public WebNavigator():base()
{
}
}
public class CustomTableDesigner : System.Web.UI.Design.ControlDesigner
{
public override string GetDesignTimeHtml()
{
WebNavigator table = (WebNavigator) Component;
if (table.Rows.Count==0)
{
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
HyperLink link1 = new HyperLink();
link1.Text = "Home";
link1.NavigateUrl = "Home.aspx";
cell1.Controls.Add(link1);
row.Cells.Add(cell1);
TableCell cell2 = new TableCell();
HyperLink link2 = new HyperLink();
link2.Text = "About Us";
link2.NavigateUrl = "AboutUs.aspx";
cell2.Controls.Add(link2);
row.Cells.Add(cell2);
table.Rows.Add(row);
StringWriter sw = new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
table.RenderControl(tw);
return sw.ToString();
}
else
return base.GetDesignTimeHtml();
}
}
|
|
|
|
|
I tried that, but I still have the problem where the designer adds HTML code that duplicates the rows I added in the controls constructor!
I hope the code displays ok...
<code>
... Here's the entry the designer adds initially...
<cc1:EngNavTable id="EngNavTable1" runat="server" MyLinkNumber="1">
... As soon as I modify an attribute in the custom control, all this gets added to the HTML file!
<asp:TableRow>
<asp:TableCell ColumnSpan="4" HorizontalAlign="Left" Text="<img src='images/agilityheader.jpg'>"></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell BackColor="LightBlue" Width="33%" HorizontalAlign="Center" Text="Transponder"></asp:TableCell>
<asp:TableCell BackColor="LightGreen" Width="33%" HorizontalAlign="Center" Text="Laser"></asp:TableCell>
<asp:TableCell BackColor="LightBlue" Width="33%" HorizontalAlign="Center" Text="Misc"></asp:TableCell>
<asp:TableCell BackColor="LightBlue" Width="33%" HorizontalAlign="Center" Text="<a href='http://www.agility.com'>Agility</a>"></asp:TableCell>
</asp:TableRow>
</cc1:EngNavTable></P>
</code>
|
|
|
|
|
Do you mean the duplication of the rows is that the html markups are added as soon as the control has been changed?
[DefaultProperty("Rows"), ParseChildren(true, "Rows") ...]
public class Table : WebControl
Looking at the code above, you will see that the Rows property of the control Table will be parsed by the page parser when the control is used declaratively on an ASP.NET page. It makes sure that the nested elements(rows) are in line with the count of the row collection of the control. So the html markups which are added should represent the Rows property of the control. For more information, you can see:
Control Parsing, ParseChildrenAttribute, and Control Builders[^]
Design-Time Support for Web Forms[^]
|
|
|
|
|
Is there any Calendar control tool in DHTML concepts... If not, i want to display Previous month , next month and present month calendars with complete Navigation buttons..
VenuGopal.A
|
|
|
|
|
|
I have to upload a image file from client side to server using ASP
Can any one help me
|
|
|
|
|
Hi Neeru:
If you are looking for 3rdParty Upload components, try here:
http://www.persits.com/ (ASPUpload)
For Native ASPUpload,
http://www.4guysfromrolla.com/ has an article which explains you to do the same with code example.
Deepak Kumar Vasudevan
Personal Web: http://vdeepakkumar.netfirms.com/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
I am trying to better understand CSS and am having problems. Maybe what I'm trying to do can't be done? Anyway, I am trying to recreate the look I've created at www.randommonkeyworks.com, and eliminating tables as much as possible. I finally saw the magic to 'div' tags, and their positioning tricks. But it appears they won't give me everything I want, unless I am overlooking something someone here may know.
I can see making the header a div, the sidebar a div, the footer a div, and the body a div, but then when I get to the purple frame I've placed along the top and left of the body, it blows up royally. Does anyone know any way to recreate that effect using only CSS?
(Even a bastardized conglomeration of a table inside of a div doesn't work, if I understand it correctly, as the div will not grow in height automatically unless there is text in it, and the top bar will not size right either. I won't go into much more details here, but I've tried.)
For a second question, how do you set up your navigation bar so that it is testable on your development hard drive, as well as on your actual site? What I mean is that if you use links like "/dir1/file1.html", in my case that would refer to "www.randommonkeyworks/dir1/file1.html", but on my development hard drive it refers to "D:\dir1\file1.html" (or something like that), so if the actual path is "D:\HtmlWork\Site3\dir1\file1.html", I can not test it on my development hard drive. And you have to use links like that on a navigation bar, because using relative links when your site has many subdirectories means that you have to massage the paths to the links on every page on a subdirectory basis, rather than just placing a chunk of code to absolute links. (That makes your site more brittle.) I've somewhat gotten around that with some JavaScript, but I want to know if there is a more elegant solution.
Thanks,
David
|
|
|
|