|
iam having a textbox where iam entering some text say user id then after entering the userid in the textbox and if user goes for next control then how can i validate that the user id entered is already there in my db.which event of the textbox works better.
|
|
|
|
|
Well, actually in asp.net you don't have an event on the validation of the control like in windows forms, but you can do like the following:
1) Put a custom validator control in your form
2) Set its ControlToValidate to your Textbox
3) Add a function to your code like
protected void ValidateTextboxInDB(object source, ServerValidateEventArgs args)
{
}
4) Bind the event handler to your method like:
<asp:customvalidator id="CustomValidator1" runat="server" xmlns:asp="#unknown">
OnServerValidate="ValidateTextboxInDB"
ControlToValidate="TextBox1"
ErrorMessage="Your error message.">
</asp:customvalidator>
Regards
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
hi caiokf Thanks for ur immediate reply .but how to call this when textbox is lost focus
means when user enters something in the textbox and comes out.
|
|
|
|
|
hi Lakshmi,
set ur textbox autopostback property to true in the properties pane of ur textbox.
and in the textbox textchange event u can validate the userid against the userid in the DB.This is very simple.
T.Balaji
|
|
|
|
|
in one of my project at one palce XMLHttpRequest object is been mase
Request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
var obj = this;
Request.onreadystatechange = function() { obj.OnReadyState(Request); };
Request.send(PostParams);
i objerved this send method executes the request but how it does work
how it executes query i could not got it
so i need guidence on it
Raghvendra
|
|
|
|
|
Googling AJAX would be a good starting point.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
i had a lots og googling abt how internally it works but could not get it
at each palce i got abt how and where to call it but internally everything was hidden
Raghvendra
|
|
|
|
|
Hello,
I have been reading about setting dynamic page titles in ASP.NET 2.0, in order to modify the "catalog.aspx" page of my web application. Most of the articles on this subject, however, seem to be describing somewhat complicated solutions for creating dynamic site maps, whereas I would just like to set the title of my catalog.aspx page to the name of the current category or product in my catalog.
Although I can see how to set the title property in code like so:
Sub Page_Load()<br />
Page.Header.Title = "The current time is: " & DateTime.Now.ToString()<br />
End Sub
...I can't figure out how to dump the contents of a <%# Container.Name %> -type container into this statement.
I am using a 3rd-party shopping cart package (DotNetCart), that displays categories and products on the http://www.mywebsite.com/catalog.aspx page in typical catalog fashion:
http://www.mywebsite.com/catalog.aspx?CategoryID=200 (The category named "Handbags")
http://www.mywebsite.com/catalog.aspx?CategoryID=200&ItemID=13 (The category named "Handbags", and the item "Canvas Handbag")
In the above examples, I'd like to have the page title change to "My Website: Handbags" and "My Website: Canvas Handbag" respectively.
The third-party vendor's catalog control looks sort of like this (extra tags and declarative controls omitted):
<dotnetCART:DisplayCatalog><br />
<CategoryTemplate><br />
<%#Container.Image%><br />
<%# Container.Name %><br />
</CategoryTemplate><br />
<ItemDetailsTemplate><br />
<%#Container.Name%><br />
<%#Container.ItemID%><br />
<%#Container.Price%><br />
</ItemDetailsTemplate><br />
</dotnetCART:DisplayCatalog>
How would I go about displaying the catalog control's Category and ItemDetails' Names in my page title attribute? Thanks for any advice.
|
|
|
|
|
I'm not familiar with dotnetcart, but if it supports databinding, then you should be able to handle one of the events, like ItemDataBound or something like that, and set the page title in the code behind.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
Hi,
I wanted to use forms authentication and for this i have to specify the paths for the folder that the
user is allowed to navigate to based on the roles he is in.
But the problem is i have 100 roles in my database. So its tedious to write authorization using the code
<location path="AdminModerator">
<system.web>
<authorization>
<allow roles="Administrator,Moderator">
<deny users="*">
Is there any other method to do this.
Thanks...
bitsbuilt
|
|
|
|
|
Hi All,
I want to set the ctrlKey value to true/false through code in javascript.
While trying to do this as shown, I'm getting an error like 'htmlfile: Member not found'.
But the ctrlKey property is read-write (as per msdn)
function f1()
{
event.ctrlKey = true;
}
Can any one help me please. *** Urgent ***
|
|
|
|
|
How is event passed, and how is your function called? It needs to be placed as the first argument in your function declaration to be referenced within the function.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
how can i pass product_id from database to query stirng .
in mainpage i m populating detailviewcontrol with all products from database
columns are
product_id,name,etc
i hv a button "detail about product"
and against button clicking following statment
Response.Redirect("detail.aspx?p_id=1)
i want to use product_id database field instead of constant '1' so that
in detailpage selected product detail can be displayed (not of product_id=1)
plz help me how to pass product_id in query string........ 
|
|
|
|
|
i m trying to get product_id value from detailview control and passing it as query string using following statement
Response.Redirect("detail.aspx?cat_id=" + DetailsView1.Rows(1).Cells(0).Text)
but getting error like
Input string was not in a correct format.
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.
Exception Details: System.FormatException: Input string was not in a correct format.
plz help me how to fix it or another way to pass product_id as querystring
|
|
|
|
|
It looks like you are showing the code from one page and the error page from another page.
If the cell in the DetailsView doesn't contains the representation of a number, and if you try to parse the query string without verifying it, you would get that error message when the details page loads.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I am not able to pass a form field value to a storedprocedure in detailsview. I am getting an error message. I couldn't figure out what is causing the problem. If you help me to solve it, I would really appreciate it.
The detailsview code is shown below also the stored procedure. The error message is:
"Procedure or function 'StoredProcedure1' expects parameter '@GetActivityName', which was not supplied. "
Thank you.
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" <br />
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" <br />
CellPadding="3" CellSpacing="1" <br />
DataSourceID="SqlDataSource1" DefaultMode="Insert" GridLines="None" <br />
Height="50px" Width="125px"><br />
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" /><br />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" /><br />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" /><br />
<Fields><br />
<asp:BoundField DataField="ActivityName" HeaderText="ActivityName" <br />
SortExpression="ActivityName" /><br />
<asp:CommandField ShowInsertButton="True" /><br />
</Fields><br />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /><br />
<EditRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /><br />
</asp:DetailsView><br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HolidayDBConnectionString %>" <br />
InsertCommand='StoredProcedure1' InsertCommandType="StoredProcedure"><br />
<InsertParameters><br />
<asp:Parameter Name ="ActivityName"/> <br />
<asp:Parameter Size ="50" Direction ="ReturnValue" Name="GetActivityName" /> <br />
<br />
</InsertParameters><br />
</asp:SqlDataSource><br />
STORED PROCEDURE 1
<br />
ALTER PROCEDURE dbo.StoredProcedure1 <br />
(<br />
@GetActivityName nvarchar(50)<br />
) <br />
AS<br />
<br />
BEGIN<br />
<br />
INSERT INTO activities VALUES (@GetActivityName)<br />
<br />
END<br />
<br />
RETURN<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
in my project at one place sthing like this is been writen
SetHistoryHandler(
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_GROUP, Contacts: contacts
}
);
i coule not understand what does this ':' doing when passing arguments for ex. one argument is Entity: PART_NEW_GROUP ,it contain ':' after Entity
Raghvendra
|
|
|
|
|
That is a Javascript object literal. It is similar to an array list, except the members are enclosed in curly brackets and each member is defined explicitly with a name, followed by a colon, and each member is separated with a comma, not a semi-colon. Once an object literal has been defined, then each member can be accessed with Object literal variable name.Member name
For example, if you do this:
var fruit = {apples: 1,
bananas: 2,
oranges: 3,
grapes: 20
};
This creates an object with the members apples, bananas, oranges and grapes with values of 1, 2, 3 and 20 respectively.
The members can be accessed like so:
fruit.apples;
fruit.bananas;
fruit.oranges;
fruit.grapes;
Object literals are especially useful in argument lists, as it means that the arguments don't have to all be present, or have a set order to be defined in.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
modified on Sunday, September 21, 2008 2:57 AM
|
|
|
|
|
Thanks,
now i cam corelate it in project
Raghvendra
|
|
|
|
|
i get it that
SetHistoryHandler(
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_CONTACT
}
);
var fruit = {apples: 1,
bananas: 2,
oranges: 3,
grapes: 20
};
sounds bit differ
in my one
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_CONTACT
}
does not sounds some thing like anonimeous structure means it does not have any name so we can refer some where else
i mean i could not get it fully when i do compare it, alone it make full sence to me
Raghvendra
|
|
|
|
|
SCREEN_CONTACTS and PART_NEW_CONTACT appear to be variables, so the values of ScreenId and Entity take the value of these variables.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
|
hello evry body
i am beginner in asp.net(with c#) . Im going to get IP from users that see my site.
Thank you
|
|
|
|
|
try
String userIP = Context.Request.UserHostAddress;
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
I need to generate some controls dynamically.So i code as belows:
using System;
using System.Web;
...
namespace MyProject
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
TableRow row = new TableRow();
TableCell cell = new TableCell();
Button btn = new Button();
btn.ID = "btnCreated";
cell.Controls.Add(btn);
row.Cells.Add(cell);
this.Table1.Rows.Add(row);
btn.Click += btn_Click;
}
protected void btn_Click(object sender, EventArgs e)
{
this.TextBox1.Text = "test";
}
}
...
when i run it,the table(include the new button) can be show after i click the button1 .But when i click the new button(ID as btnCreated),it doesnt work.And the worse is the created table disappears after i click the new button.
How to solve it??
|
|
|
|