|
Member 2925225 wrote: ctully my requirement is that every textbox accept only one word.
SRY
If It Helps Click It as Answer
|
|
|
|
|
No
this is not the solution.
One word menas it can accept multiple characters.
when I press space bar in textbox, focus set to another textbox .
I have resolve this if textboxes are outside the Repeater control.
But If textboxes are Inside repeater control and are generating at runtime.
how i get the id of the textboxes created at runtime ?
and how it set the focus in textboxes in space bar key press?
Thanks
vikas
sdsds
|
|
|
|
|
Member 2925225 wrote: how i get the id of the textboxes created at runtime ?
ClientID property
Member 2925225 wrote: and how it set the focus in textboxes in space bar key press?
you can catch events in javascript and call the focus() method of a control you look up with document.getElementById
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi
Please send any help ful link to resolve this.
Thanks
Vikas
sdsds
|
|
|
|
|
Sorry Chris, I might be asking similar type question earlier also but this is final summary.
Suppose we have designed a master page. Say we keep nothing in it.
We inherit it in a webform.
Now I have observed the following. Please confirm,reply also:
1. <form> /<form> is not present.
HTML Reset button works fine.
Document.getelementbyid-> does not work because form is not present.
2. In web form where i have inherited master page, I keep one html reset button and standard asp text box.
If autopostback of textbox=true then
whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load).
If autopostback of textbox=false then
whatever we enter in textbox and click on reset, value will be cleared.
3. In my requirement i have inherited master page in web form as mentioned above.
It's requirement to keep autopost back of textbox=True.
Now reset will never clear the values of text box.
In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified.
function ResetForm(){
var elems = document.forms[0].elements;
for(var i=0;i<elems.length;i++){
elems[i].value = "";
}
}
So in webform (using master page), how to clear the values of text box on clicking of button.
Note: document will not work because <form> is not present.
autopost back will be true for text box because we have to trigger event TextBox1_TextChanged1 also.
TextBox1_TextChanged1 will not work without autopostback.
So plz tell me solution.
|
|
|
|
|
amittinku wrote: <form> /<form> is not present.
your page is broken if this is true
amittinku wrote: If autopostback of textbox=true then
whatever we enter in textbox and click on reset, page load occurs.It will retain the values. Now value from text box will not be cleared after clicking on Reset. Because reset sets it back to inital value (that we got after page load).
If autopostback of textbox=false then
whatever we enter in textbox and click on reset, value will be cleared.
Because you don't have a form
amittinku wrote: In that case, if i use simple HTM button (not reset) and try to write the following code, it does not work because <form> is not present. So document will not be identified.
Correct
amittinku wrote: So in webform (using master page), how to clear the values of text box on clicking of button.
PUT A FORM ON THE PAGE !!!!
And don't post a new question when your old one is still visible, and you're asking the same thing.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
PUT A FORM ON THE PAGE !!!!
I have inherited master page. Now I will have to paste controls on Content.
Can we still post a form, there is so speciic control as such
|
|
|
|
|
Your master page defines the form, if it's written right. The content pages go inside the form. An ASP.NET page should only have one form on it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
In Asp .net set the Text Box property EnableViewState="false" then ur prob are solve.........
|
|
|
|
|
Hi To,
I Want to count visitor no of our site and also display it in my site by which user can see his visitor no of site.
for which I have written this code in globle asax in application start event and show it in the master page.
but the value is reset every time.
The code is ..
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("visitor") = 1
End Sub
and the code of session_start is..
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("visitor") = CType(Application("visitor"), Integer) + 1
End Sub
and
display it in the form load int master page
Me.Label1.Text = "Visitor No " + Application("visitor").ToString()
|
|
|
|
|
Samarjeet Singh@india wrote: Me.Label1.Text = "Visitor No " + Application("visitor").ToString()
Of course you don't call it Label1, right ?
Of course it's reset. EVery time the application is. You need to persist it somewhere for it to never reset, like a text file or a DB.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thnks for Reply...
Yes it may be value reset but I am taking application type variable then why it is reset from 100 to 1. just give me some hints. is there any way inwhich we can show it with out store db or file....
|
|
|
|
|
Samarjeet Singh@india wrote: just give me some hints. is there any way inwhich we can show it with out store db or file....
Well, that's what I just told you to do, didn't I ? Which bit are you stuck on ? If you've written a website that is likely to care about a visit count, surely you know how to use a database, or a flat file ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This code is for current visitors on site if you implement Session_end event too. If you are trying to count total visitors you must use a database or any kind of data storage
|
|
|
|
|
As Christian said, on application start get that text file/DB to display total number of visitors and on session start get that value,add 1 and save back.
|
|
|
|
|
it's very easy process you may go now this url http://www.amazingcounters.com
And Chose Your Visitor Counter Designed & Copy the code or Add ur Site master page...................
|
|
|
|
|
I have done the crystal report throught Visual Studio IDE as web site. It is working fine. but when i run the same from the site (available in the local machine) it is throwing error as connection failed.
I have not published the web site.
Kindly help
Gan
|
|
|
|
|
Check The Connection String Of the Crystal report
If It Helps Click It as Answer
|
|
|
|
|
Ganesh_061974 wrote: but when i run the same from the site (available in the local machine)
From where ? VS or IIS ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
There is Standard test box on webform i.e. <asp:TextBox>
There is one HTML button on screen i.e. <input id="button1">
on Button1_onclick(), I want to clear the text entered in text box.
When I run it, It is not recognising text box object.
Note:code is in aspx file only, no code in aspx.cs file.
Check the code below, why <input id="button1"> not recognising <asp:TextBox> in java script:
---------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="button_postback.aspx.cs" Inherits="button_postback" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
// <!CDATA[
function Button1_onclick() {
t1.text="";
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
&nbsp;
<asp:TextBox ID="t1" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></div>
</form>
</body>
</html>
|
|
|
|
|
I believe that if you created a textbox called t1, then document.t1 MAY work. I dunno, I always use document.getElementById to look up controls. However, either way, you have not created an element called t1. You may want to buy some books on ASP.NET and research the framework you're using.
ASP.NET generates it's own id based on the server side id you provide. You can use the ClientID property of the control in your code behind to get the right id to pass to your javascript. Either way, you should always read your html by viewing source in the browser as a first step to understanding issues like this.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
document.getElementById('') works fine if <form></form> are present.
Now my requirement is that I inherit any content template on webform. Due to this, <form></form> is not present now.
I drag drop HTML button (<input type="button") and asp text box(asp:textbox).
Now in java script code, document.getElementById(''); does not work, it is not recognsising asp.net textbox because both HTML button and asp text box are not present under <form>.
So how to achieve in that case.
|
|
|
|
|
Why do you need to not have a form ? Do asp: controls work in that case at all ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
There is HTML button (<input type=reset>) on screen.
There is text box (asp:textbox) on screen.
----------------------------------
I have written the below code.
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
Response.Write("hi");
}
Autopost back of text box=false.
Whatever I put in textbox, reset clears it.
Now suppose I make Autopost back of text box=true.
Say enter any text in text box. Now click on say screen. post back will take place, page load will occur. Now I click on "reset", text does not get cleared. WHy?
|
|
|
|