|
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TextBox1" <>></asp:RequiredFieldValidator>
hi the above code validate 1 textbox izzit possible to let it validate multiple textbox with 1 validator?
|
|
|
|
|
Dont think it is possible.
U need to use different validation controls for different text boxes.
|
|
|
|
|
I think you need to loop thru each textbox and assign the validator to it.
Or you could create validators for each textbox.
|
|
|
|
|
marky777 wrote: I think you need to loop thru each textbox and assign the validator to it.
Surely this would simply update the "ControlToValidate" property multiple times and still end up verifying only a single textbox?
|
|
|
|
|
any one know how to edit the gridview template to have data type validation?
currently if the data type is incorrect the page is routed to an error page and shown the error how can i show the error in an lblerror.text?
also izzit possible to make the input textbox into a listbox which is bind to the database?
|
|
|
|
|
i just tryed changing it into a template and one of the field became this
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Comments") %<'></asp:TextBox>
so instead of a textbox i changed it into a dropdownlist however how do i bind the Text='<%# Bind("Comments") %<'
in the dropdownlist? anyone know pls tell
|
|
|
|
|
I have a java script
function goToNewPage(dropdownlist)
{ var url = dropdownlist.options(dropdownlist.selectedIndex).value;
if (url != "")
{ window.open(url); } }
I have a dropdownlist and in code behind file I have this code
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList1.Attributes.Add("onchange","goToNewPage(this.value)");
}
But it is not doing anything. Even if I set break points it doen't go there.
All I want that if I select ant item in dropdownlist it takes me to some url.
|
|
|
|
|
hahii wrote: DropDownList1.Attributes.Add("onchange","goToNewPage(this.value)");
Try placing this in page load event and remove selected index changed event.
|
|
|
|
|
I did that but doesn't work.
|
|
|
|
|
Is you javascript function is getting called properly?
Best Regards,
Apurva Kaushal
|
|
|
|
|
How I come to know that it is called properly.
|
|
|
|
|
You can put a alert in your javascript and see whether you are getting any message or not.
Best Regards,
Apurva Kaushal
|
|
|
|
|
I have a table with two columns
AppName AppLocation
TestApp1 folder1
TestApp2 folder2
TestApp3 folder3
TestApp4 folder4
TestApp5 folder5
I have to shows data of column AppName in dropdown list.
I created a sqldatasource and bound that to dropdownlist.
I set DataTextField = AppName and DataValueField = AppLocation.
Now I have a java script I called it at onchange method e.g which is always in or tags in html. But as I already bound the dropdownlist with datasource so in html source I couldn’t see or tags so where is onchange method where I can call java script.
|
|
|
|
|
How you are attaching your javascript to the dropdown list?
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hello,
i am working on a project that requires users to goto a certain web page and this web page will display their system specs
i can do that using ASP.net / WMI, however that will give me the specs for the server, what i really need actaully is the specs for the client (ex. OS, Physical Memory, computerName, etc.)
is there a way to do that without doing ActiveX approach?
any ideas
thank you
Tamer A. Rahman
Software Devloper (MCPD)
Using Java,C# and ASP.net
|
|
|
|
|
I have a dropdown list. I bound it to a sqldatasource.
It is showing me following items which are in database.
App1
App2
App3
But I want that my dropdown list should look like following. How can I get the text --Select Item -- on
first index though I attach sqldatasource to dropdown.
--Select Item--
App1
App2
App3
|
|
|
|
|
Do something like this:
dropdownlist.Items.Add(new ListItem("--Select Item--"));
dropdownlist.AppendDataBoundItems = true;
dropdownlist.datasource = somedatasource;
dropdownlist.TextField = "Something";
dropdownlist.ValueField = "somefield";
dropdownlist.DataBind();
Thats all you have to do. Add an item in the list and then set AppendDataBoundItems = true before you bind the list to a data source.
|
|
|
|
|
I've created a literal for each of my text snippets (<asp:literal id="ABCDUnique">blah blah blah). I have other literals that are updated based on code execution, so that is the reason all literals start with ABCD.
In Page_Load, I do something like:
string pageName = "UniqueName";
languageCode = 1;
TranslateControls(pageName, this.Controls);
I then define the TranslateControls method as:
private void TranslateControls(string pageName, ControlCollection controls)
{
for (int i=0; i < controls.Count; i++)
{
Control ctrl = controls[i];
if (ctrl.HasControls())
{
TranslateControls(pageName, ctrl.Controls);
}
else
{
if (ctrl.GetType() == typeof(System.Web.UI.WebControls.Literal))
{
if (ctrl.UniqueID.StartsWith("ABCD"))
{
Literal litTemp = (Literal)ctrl;
Database db = new Database();
string textTranslation = db.GetText(pageName, ctrl.UniqueID, languageCode);
litTemp.Text = textTranslation;
}
}
}
}
}
Problem is, some controls are ignored -- when logging/stepping through, it appears that they are not part of the ControlCollection. Any thoughts/ideas?
-- modification
When page is initially loaded, all controls are displayed properly. However, on postback, some controls are missed and appear blank (odd, as they have initial text, and the db.GetText method returns either valid text or ctrl.UniqueID surrounded by underscores).
-- end modification
Thanks,
Glenn
-- modified at 16:07 Wednesday 25th April, 2007
|
|
|
|
|
Delete else please.This is a logical error.
|
|
|
|
|
Even with the else removed, the literals do not appear.
|
|
|
|
|
Glenn E. Lanier II wrote:
When page is initially loaded, all controls are displayed properly. However, on postback, some controls are missed and appear blank (odd, as they have initial text, and the db.GetText method returns either valid text or ctrl.UniqueID surrounded by underscores).
Knowing this bit had something to do with it, after much head-banging/debugging, I realized that my literal was not listed in the .cs file.
My non-required fields displayed, as they are defined:
<label for="txtBillFirstName"><asp:label id="lblBillFirstName" runat="server"><asp:literal runat="server" id="litTextBillNameFirst">First Name:</asp:literal></asp:label></label><br />
but the [initially] required fields were not, defined as:
<label for="txtBillFirstName"><asp:label id="lblBillFirstName" runat="server">* <asp:literal runat="server" id="litTextBillNameFirst">First Name:</asp:literal></asp:label></label>
Apparently, you can have an asp:literal in an asp:label if it is the only thing in the label, but mixing text with a literal doesn't appear to work.
The initial text displayed on the page load, but not on a postback - not sure why even the * didn't show up. Some of the fields are only required based on selections made on the form, so if I cause the error conditions, those labels displayed as required, which threw me off track a little.
--G
-- modified at 12:41 Thursday 26th April, 2007
|
|
|
|
|
hii,
i want to create a webform in the runtime. it is something like a tool to build a web form?
do u have any ideaies?
thanks
|
|
|
|
|
One Idea!!!
How bout if you use XML and XSLT
Create xml after reading the tables in database you might be bulding forms upon
and then convert xml by using xslt?
If not depending on tables on database just make some rules to create xml which
will represent a form and then convert that through xslt?
What do you think?
|
|
|
|
|
Hi
I have 2 Textboxes I need to compare the value of the 2 Textboxes I have a method it is working fine .But When I enter the Space it is giving error.
So pls provide me solution this is very urgent.
Thanks,
|
|
|
|
|
user this trim function for doing trim operation
function trim(str)
{
str.replace(/^\s+/,'').replace(/\s+$/,'');
}
usage
trim(document.forms[0].textbox1.value)
-- modified at 9:22 Thursday 5th July, 2007
|
|
|
|