|
|
sarangkhandare wrote: some of my files are corupted(damaged) in XP.can any one tell me how to repair it or recover it ???
How does it related with ASP.NET ? You are in a wrong forum !!
|
|
|
|
|
Why don't you repair you installation?
Cheers!!
Brij
|
|
|
|
|
My config:
VS 2005 Pro with SP1
C# 2005
.NET Framework 2.0 SP2
Vista Ultimate SP1 all current patches applied
P4 3.0ghz w/ 1.5GB RAM and (1) 300GB disk w/ 27.5GB free (system/boot disk), (1) 400GB disk w/ 74GB free
Problem: no matter how simple an app I create, debugging does not work - i.e. I can set a breakpoint that I know is crossed but the app does not fall into the debugger. These are .NET web apps. I created one with a single form and created several breakpoints, one in Page_Load against a simple string which I programmatically set a value for and one in an asp:validator that I know is hit and passed.
VS even asks to set the app for debugging, and IE is set to show scripts, etc.
Can someone help me to understand what I'm missing and why I can't debug anything simple or complex? You can probably imagine this is making me crazy and I'm having to write data to textboxes just to see what's happening when something goes wrong. Some things I just can't test for at all because of this.
Thanks in advance!
|
|
|
|
|
Hi Mike..
<%@ Page Language="VB" MasterPageFile="~/........"
AutoEventWireup="true" CodeFile=".....aspx.vb" Inherits="......" title="....." %>
Change autoeventwireup to TRUE and try....
Regards
Rajeesh MP
|
|
|
|
|
Unfortunately, all pages have AutoEventWireup="true", here's a sample of a simple app page:
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ValidaTest._Default" %>]]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Pick a Team Name</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2>Pick a name for your team</h2>
Name:
<asp:textbox id="txtTeam" runat="server" xmlns:asp="#unknown" />
<asp:button id="btnValidate" runat="server" text="Go" xmlns:asp="#unknown" />
<br />
<asp:requiredfieldvalidator id="reqval_txtTeam" runat="server" xmlns:asp="#unknown">
ErrorMessage="You must enter a team name."
ControlToValidate="txtTeam" Display="dynamic" />
<asp:customvalidator id="custval_txtTeam" runat="server">
ErrorMessage="That name is already taken. Please pick another."
ControlToValidate="txtTeam" Display="dynamic"
OnServerValidate="custval_txtTeam_ServerValidate" />
<asp:label id="lblResult" runat="server" enableviewstate="false" />
</asp:customvalidator></asp:requiredfieldvalidator></div>
</form>
</body>
</html>
Thanks for trying - it seems to be something deeper. When I press f5, everything executes, just no stopping at breakpoints. The Build is set to Debug as the active, DEBUG and TRACE constants are defined, it's set to full debug mode, any CPU and platform and the ASP.NET debugger is checked.....
Strangest thing.....
|
|
|
|
|
i had same problem, it solved by when i start dotnet framework by right click and run as administrator on VS sort cut or on programs.
you may try this.
Anshuman Singh
|
|
|
|
|
Thanks - that was the answer - for whatever reason, even though my Vista ID is an Administrator, I have to explicitly start VS by running as an Admin by right-clicking. Thanks for fixing me up!
|
|
|
|
|
hi Anshuman..
thatz a good one..Thanks for the information
Regards
Rajeesh MP
|
|
|
|
|
<br />
<br />
CS1502: The best overloaded method match for 'System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(string, string)' has some invalid arguments<br />
<br />
Source Error:<br />
<br />
<br />
<br />
Line 27: <br />
Line 28: objLogin = new STR_USERS(); <br />
Line 29: objLogin.PASSWORD_PRO = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword, "MD5"); <br />
Line 30: objLogin.USERNAME_PRO = FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserName,"MD5");<br />
Line 31: <br />
I don't why I got this error.
|
|
|
|
|
amistry_petlad wrote: Line 27:
Line 28: objLogin = new STR_USERS();
Line 29: objLogin.PASSWORD_PRO = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword, "MD5");
Line 30: objLogin.USERNAME_PRO = FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserName,"MD5");
Line 31:
Assuming txtPassword and txtUserName are TextBox controls, you need to call the .Text property on them. If you attempt, as you have done, to pass references to the controls themselves, you get a compile-time error because the method was expecting an instance of a string, not a TextBox control.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hello Everyone,
I am a newbie to the world of ASP.NET and I am trying to create a web based questionnaire/test. The user clicks on a link to start the test and the page that presents itself has questions and appropriate input control (text box or checkboxes, etc) for the user to answer. Based on the type of test that user selects, I have to present the form which gets questions from a database and it can be any number of questions.
I do not know a good way to generate all the required text boxes dynamically, because, I have an aspx file, which just has the page skeleton (header and all) but the remaining content has to be set by the cs file for the form. I have found a way of doing this, but am not sure if (I don't think this is) this is the right way - in my cs file, I create the entire html form using StringBuilder and then set the innerHTML of a div in my aspx. I don't even know if this will work whent he user completes the test and submits it (haven't gotten that far yet) - i.e. I do not know if I'd be able to retrieve the values from text boxes, which are named like txtAnsToQues1, txtAnsToQues2, etc.
Any help or a right direction is appreciated.
(I did search the forum first and came up with some dynamic form results, but none answered what I am looking for - perhaps this is too basic?)
Thanks,
~R
|
|
|
|
|
The easiest way to approach this would be to use a data-bound control like a ListView to display the questions and corresponding input controls. Within the ItemTemplate for your data-bound control, you can declare an instance of each type of input control you want to use (TextBox, CheckBox etc.) Then at run-time, override the ItemDataBound event for your control and show/hide each input control for the current question being rendered as appropriate. On postback, to save the user's input, loop through the Items collection for the control, use FindControl to locate the correct control containing the user's input, then save the information to your database (or whatever)
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Paul,
Appreciate your response - it reinforces the fact that I am a newbie (but I'll get there) . I am going to read in detail on the ListView to see how and if I can use it in my case. I need to present a beautiful looking form, with (dynamic number of) categories, each having (dynamic number of) questions and each question needs to have an appropriate (let's say its only text box for now) control against it. And yes, on postback, I need to go through each answer and save it in a DB. The form needs to look beautiful and organized in catgories with a layout something like
-------------
Category One |
-------------
--> Question 1. In context of gravitational force, what is the difference between 'g' and 'G'?
Answer 1. [Text Box]
--> Question 2. What is the formula for the gravitational pull between two bodies of mass M1 & M2 that are x distance apart?
--> Answer 2. [Text Box]
-------------
Category Two |
-------------
--> Question 1. In context of gravitational force, what is the difference between 'g' and 'G'?
Answer 1. [Text Box]
--> Question 2. What is the formula for the gravitational pull between two bodies of mass M1 & M2 that are x distance apart?
--> Answer 2. [Text Box]
Will the ListView allow for the tables (that's how I am grouping categories and ques within), images, etc?
Thanks,
|
|
|
|
|
To display a list of questions grouped by category you would need 2 ListView controls, one nested inside the ItemTemplate of the other.
Have a look at this[^] open-source ASP.NET Questionnaire application. I've used it in the past as a building-block for creating a survey website.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I was unable to download the sample from the link you pointed me to, but I read a little about ListView control at another website and so far it looks promising. In the sample I read, they had used and asp:AccessDataSource in the aspx file itself and simply pointed to the mdb file with a SELECT query. In my case, I need to select categories from table 1, loop over categories and select questions for each. Not sure how to do this...
Paul - please know, your help and time are much appreciated
Many thanks,
~R
|
|
|
|
|
Bind your parent ListView control that is displaying the categories to a SELECT query that fetches these categories.
Handle the ItemDataBound[^] event for your parent ListView control. This will fire each time data for an individual category is bound to the list control.
The following code demonstrates how to handle this event and use LINQ to get all orders for the child list control associated with a customer from the parent list control. It uses data from the Northwind database. The parent list control is bound to a SqlDataSource control.
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
string customerID = ((System.Data.DataRowView)((ListViewDataItem)e.Item).DataItem)["CustomerID"].ToString();
ListView listView2 = e.Item.FindControl("ListView2") as ListView;
using (NorthwindModel.NorthwindEntities context = new NorthwindModel.NorthwindEntities())
{
var orders = (from o in context.Orders
where o.Customers.CustomerID == customerID
select o).ToList();
listView2.DataSource = orders;
listView2.DataBind();
}
}
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Paul,
Cannot thank you enough... but Thanks!
~R
|
|
|
|
|
Hi Paul,
I would have posted this as a separate question, but then I would have needed to explain what I am doing and how I am binding the nested ListViews... so I thought I'd try sending my question to you and hope for an answer.
So I have nested ListViews - the parent displays the categories, and in the ItemTemplate of this parent, I have another ListView that displays the questions under that category - now is there a way for me to get the category name bound to parent listview, in the child listview? I can achieve this by modifying my SQL and populate the data source of the child lv with category name as well, but I don't think that's the right way (unecessarily retrieving the category name again, when, it is already available).
Note - the category name is not available in any control of parent lv - it is just displayed using <%#Eval%> within a <th>
Appreciate your help - hope I am not pushing it.
~R
|
|
|
|
|
Yes. You can use a data binding expression to do this.
Below I have posted the code for a page that displays a hierarchical list of customers with orders from the sample Northwind database using ADO.NET Entity Framework. I use a databinding expression in the child list control displaying order details to display the customer's country against every order. The databinding expression is a bit clumsy (lots of calls to .Parent) but it works.
ASPX code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server"
onitemdatabound="ListView1_ItemDataBound">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li><%#Eval("CustomerID") %></li>
<asp:ListView ID="ListView2" runat="server">
<LayoutTemplate>
<ul>
<asp:PlaceHolder ID="itemPlaceHolder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li><%#Eval("OrderID") %> <%#((NorthwindModel.Customers)((ListViewDataItem)Container.Parent.Parent.Parent).DataItem).Country %></li>
</ItemTemplate>
</asp:ListView>
</ItemTemplate>
</asp:ListView>
</div>
</form>
</body>
</html>
Code-behind file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
using (NorthwindModel.NorthwindEntities context = new NorthwindModel.NorthwindEntities())
{
ListView1.DataSource = from c in context.Customers
orderby c.CustomerID
select c;
ListView1.DataBind();
}
}
protected void ListView1_ItemDataBound(object sender, ListViewItemEventArgs e)
{
string customerID = ((NorthwindModel.Customers)((ListViewDataItem)e.Item).DataItem).CustomerID;
ListView listView2 = e.Item.FindControl("ListView2") as ListView;
using (NorthwindModel.NorthwindEntities context = new NorthwindModel.NorthwindEntities())
{
var orders = (from o in context.Orders
where o.Customers.CustomerID == customerID
select o).ToList();
listView2.DataSource = orders;
listView2.DataBind();
}
}
}
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Aha! The Container.Parent - thanks a lot Paul. I did find a workaround, but this is definitely looks sleeker.
My workaround:
In the ItemDataBound of parent lv, where I bind the child lv's data, I modified my SQL - I now first retrieve the category name using:
string catgName = ((System.Data.DataRowView)((ListViewDataItem)e.Item).DataItem)["quesCatgName"].ToString();
Then set my SQL to:
sqlStr = "SELECT quesId, quesText, quesHint, '" + catgName + "' as quesCatgName FROM....."
This way, the category is available as 'quesCatgName' in the child lv - dunno if this causes a greater overhead - I will modify my code to use the approach you sent.
Thanks,
~R
|
|
|
|
|
when trying to login from Logon page it is loging and going to master page and in the Master page different hyperlinks, when i click on any link it is redirected to Logon page.
Login Page btnlogin click code
if (DatabaseLayer.AdminDAO.UserExists(txtUserName.Text, txtPassword.Text))
{
FormsAuthentication.SetAuthCookie(txtUserName.Text, false);
Server.Transfer("~/Admin/Presentation Layer/MainPage.aspx");
}
else
{
Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "msgbox", "alert('Sorry ! Your Login Failed');", true);
}
}
Web.config Code
<authentication mode="Forms">
<forms name="appNameAuth" path="./Admin/" loginurl="./Admin/Admin.aspx" protection="All" timeout="30">
<authorization>
<deny users="?" >
<authorization>
Main Page One Hyper Link
<asp:hyperlink id="HyperLink15" runat="server" navigateurl="~/Admin/Presentation Layer/News.aspx" xmlns:asp="#unknown">News
While clicking any of the Hyper Links it is redirecting to Logon Page.
|
|
|
|
|
in my web application my session got expire while working,
i have specified timeout 20
plz help me to solve this problem
|
|
|
|
|
mohit_p22 wrote: plz help me to solve this problem
What problem? Please restate in the form of a question.
only two letters away from being an asset
|
|
|
|
|
mohit_p22 wrote: in my web application my session got expire while working,
i have specified timeout 20
plz help me to solve this problem
I don't see what the problem is.
Is it that the session expired early? Did you not get a session at all? Is it something else?
|
|
|
|