|
Howdy
I'm not sure if you can disable the Back and Forward buttons but you could always look at having a multiview with each page on a panel. Keeping track of the current position of the students in either the Viewstate[] or the session. If they try to view a page number less than the current page then redirect them to the current page.
Make sense?
If not I'll give you some pseudo code.
Cheers
Q
|
|
|
|
|
I have the following code for my asp page, but I'm having a problem displaying more than 1 word within a field on the table. For example, I have a phone number field and its only displaying "(916)" instead of "(916) ###-####"... or even a title like "Long" instead of "Long Income...". Any ideas on how to get the entire field to display properly?
___________________________________________________________
<%do until rs.EOF%>
<%Response.Write("")%>
<%for each x in rs.Fields%>
<%
if IsNull(x.value) then
Response.Write("")
else
'Response.Write ("<id=" &="" x.name="" count="" "="">" & x.value)
Response.Write ("" )
end If
%> <%next
count = count + 1
rs.MoveNext%>
___________________________________________________________
Thanks
Kurtis
|
|
|
|
|
For reporting purposes, is it possible to display a .SNP file on an ASP.Net website? My codebehind is in C#, I'd appreciate a code sniplet. Thanks.
|
|
|
|
|
ok, I am dynamically creating hidden controls in my page by using:
<br />
ClientScriptManager cs = Page.ClientScript;<br />
cs.RegisterHiddenField("hid" + name.Replace(" ", ""), "");<br />
I am trying to reference this control after they hit submit by doing this:
<br />
HtmlInputHidden hc = (HtmlInputHidden)Page.FindControl("hidChicago");<br />
it keeps coming up null..
I wasn't sure what to Cast it as since it was created using RegisterHiddenField.
I tried both HtmlInputHidden and HiddenField and still null.
This page is a child to a Master Page.
When using RegisterHiddenField it adds it in the area where the __EVENTTARGET and __VIEWSTATE would be found.
My question is, why wouldnt the control be found when looking from the Page level?
Also, here is what that RegisterHiddenField created:
<br />
<input type="hidden" name="hidChicago" id="hidChicago" value="" /><br />
It didnt put the "ct100_ContentPlaceHolder1" in front of it, either because its not in the ContentHolder, which would make sense, or its not registering it with a runat=server.
what do you guys think?
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
By the looks of things it doesn't actually create a control, just outputs a hidden form field. You should be able to access its value via Request.Form["hidChicago"] (of course you have to stick something in there first!)
|
|
|
|
|
How embarrassing..haha.it worked.
I apologize. I totally forgot about Request.Form.
Thanks for the help.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
hi friends
i have one gridview in which i have one delete button
.i write code for confirmation to delete on row_deleting events of datagrids.
But i am facing from one problem.
When first time i click on button then its doesnt give any confirm message after that when i click again then it gives message.
Plz help me out
my code is
protected void GV_userlist_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LinkButton bt = (LinkButton)GV_userlist.Rows[e.RowIndex].FindControl("BT_delete");
bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');");
}
thanks
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Hi,
When the page is first rendered, the link button will not have the
onclick attribute.
U R adding the confirmation property after the page has been posted back.
The newly rendered page will have the link button with onclick attribute set.
That is why, the confirmation messaged is displayed for the second time alone.
U will have to add the onclick attribute before the page is loaded for the first time.
Try this:
GV_userlist.Databind();
for(int i=0;i<GV_userlist.Rows.Count;i++)
{
LinkButton bt = (LinkButton)GV_userlist.Rows[i].FindControl("BT_delete");
bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');");
}
Regards,
Arun Kumar.A
|
|
|
|
|
Call on page load even it will work properly
page load()
{
bt.Attributes.Add("OnClick", "return window.confirm('Are you sure want to remove this user?');");
}
Sujit
|
|
|
|
|
Why not just add it to the tag in the aspx page?
<asp:LinkButton OnClientClick="return window.confirm('Are you sure want to remove this user?');"></asp:LinkButton>
|
|
|
|
|
Hi plz help
This code is not working ,i m using asp.net 2.0 with C#
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if ((txtUser.Text == ds.Tables["CreateAccount"][i]["User_Name"]) && (txtPassword.Text == ds.Tables["CreateAccount"][i]["Password"]))
Response.Write("You have succesfully logged in");
else
Response.Write("User Name Does Not Exist");
}
Thanks
CARE CAREER
|
|
|
|
|
Care Career wrote: This code is not working
That is vague. What do you mean by "not working"?
|
|
|
|
|
I'd probably use something like
if ((ds.Tables["CreateAccount"].Select(string.format("User_Name = '{0}' AND Password = '{1}'", new object []{txtUser.Text,txtPassword.text})).length ==1)
//login message
else
//failed message
except i wouldn't process the message like that, i'd do a query such as:
Select count(*) from users where User_Name = <username> AND Password = <password>
and check that the return value was 1. The danger would be that someone will pick up your asp.net login function and deploy it in winforms where the client would have a list of all the username / password entries in the database.
Russell
|
|
|
|
|
The code will produce output for all row of the table. So user never understand that he successfully logged in or not.
|
|
|
|
|
Well firstly you can't apply indexing with [] to a DataTable - it should be more like this (note bold text)
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if ((txtUser.Text == ds.Tables["CreateAccount"].Rows[i]["User_Name"]) &&
(txtPassword.Text == ds.Tables["CreateAccount"].Rows[i]["Password"]))
{
Response.Write("You have succesfully logged in");
}
else
{
Response.Write("User Name Does Not Exist");
}
}
Also - I'm no C# guru but I find using the curly braces helps improve readability - one of the experts can correct me if I'm wrong but I don't see any harm in using curly braces in your "if" statement in this context.
Secondly, how do you know that the username doesn't exist if the password is wrong? I'd suggest either breaking it down into 2 separate helper functions to determine where the problem is or (easier) changing the response to "Either the username or password is incorrect".
Thirdly, you are passing the password as plaintext, which leads me to assume you're saving the password as plain text - bad idea. Rather use a hash to encrypt the password before processing or saving. Take a look at this[^]
|
|
|
|
|
Have you tried putting a .ToString() at the end of the DataSet?
<br />
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)<br />
{<br />
if ((txtUser.Text == ds.Tables["CreateAccount"].Rows[i]["User_Name"].ToString()) &&<br />
(txtPassword.Text == ds.Tables["CreateAccount"].Rows[i]["Password"].ToString()))<br />
{<br />
Response.Write("You have succesfully logged in");<br />
}<br />
else<br />
{<br />
Response.Write("User Name Does Not Exist");<br />
}<br />
}<br />
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
And to add to that in your for loop, its zero based..you need to make it like this:
<br />
for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)<br />
{<br />
<br />
}<br />
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
I did it "off-the-cuff" & missed that one (oops! & thanks), what did you think of the rest or the advice?
|
|
|
|
|
ismailiiuc is right. This will loop through the whole DataSet.
what you should do is take it out of a loop all together. Its not needed.
There should only be one username and password in there.
after you fill your DataSet just do this:
<br />
if (txtUser.Text == ds.Tables["CreateAccount"][0]["User_Name"].ToString() && txtPassword.Text == ds.Tables["CreateAccount"][0]["Password"].ToString())<br />
{<br />
Response.Write("You have succesfully logged in");<br />
}<br />
else<br />
{<br />
Response.Write("User Name Does Not Exist");<br />
}<br />
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
use this to find data from table
ds.Tables["CreateAccount"].rows[i]["User_Name"].tostring();
or
ds.Tables[0].rows[i]["User_Name"].tostring();
Sujit
|
|
|
|
|
I have a webform that includs the xml web server control which uses the xml file and xsl file to show my CV data(doesn't use ado.net) So how could I get a printable format like PDF from this page?.
I am too late but i will never give up
|
|
|
|
|
Hi
Tell me In asp.net CofigurationSetting class from which Namespace is derived.
& also tell me Wht is the diff. b/w Covert & cast in SQL SERVER.
Thanks & Regards
CARE CAREER
|
|
|
|
|
Care Career wrote: Tell me In asp.net CofigurationSetting class from which Namespace is derived.
It isn't in ASP.NET framework. It is in the main body of the .NET framework in the system.Configuration namespace.
Care Career wrote: tell me Wht is the diff. b/w Covert & cast in SQL SERVER
Now this really ought to be in a different forum. But here's the documentation for CAST and CONVERT[^]
|
|
|
|
|
Hi,
Diff. between CAST and CONVERT
If you're just changing data from one form to another for use, such as changing a "31" from a varchar to an int, use CAST; Convert offers more options than cast which may lead to more processing time. And by this, I of course mean MINIMAL, not noticeable processing time. Convert allows you to add a format style to your convertion, if you want it to. For example, if you're changing a date to a string, you can say which part of the date to return instead of returning the whole thing and making .NET format it.
CONVERT is specific to SQL Server, and allows for a greater breadth of flexibility when converting between date and time values, fractional numbers, and monetary signifiers.
Regards,
Sandeep Kumar.V
|
|
|
|
|
Explicitly converts an expression of one data type to another. CAST and CONVERT provide similar functionality.
Syntax
Using CAST:
CAST ( expression AS data_type )
Using CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
Regards,
Satips.
|
|
|
|