|
I have fixed the issue.
Basically I changed the DateTime Property to static.
Thanks for the reply's...
Illegal Operation
|
|
|
|
|
Its good that you fixed the issue.
But IMO, static variables are not too good in web applications. If possible, try to use something else, maybe a Session Variable.
|
|
|
|
|
Thanks for that tip. I will look into using session variables in the future. I did add this variable to my Data Access Layer so its not in my web application at the moment.
Illegal Operation
|
|
|
|
|
I have an ASP.Net Page using C# and I am getting this error:
No value given for one or more required parameters.
Here is my code. Any help would be appreciated.
<asp:HiddenField ID="hidfld1" runat="server" />
<br />
<asp:HiddenField ID="hidfld2" runat="server" />
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/mail.mdb"
DeleteCommand="DELETE FROM Email WHERE ((Email = ?) OR (Email IS NULL AND ? IS NULL))"
InsertCommand="INSERT INTO Email (Email) VALUES (?)"
SelectCommand="SELECT Email FROM Email WHERE (Email = ?)">
<SelectParameters>
<asp:Parameter Name="Email" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="Email" Type="String" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="Email" Type="String" />
</InsertParameters>
</asp:AccessDataSource>
Code:
protected void Page_Load(object sender, EventArgs e)
{
hidfld1.Value = Request.QueryString["Email"].ToString();
hidfld2.Value = Request.QueryString["ACT"].ToString();
if (hidfld2.Value == "S") AddRec();
else DelRec();
}
protected void AddRec()
{
try
{
AccessDataSource1.InsertParameters["Email"].DefaultValue = hidfld1.Value;
AccessDataSource1.Insert();
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
protected void DelRec()
{
try
{
AccessDataSource1.DeleteParameters["Email"].DefaultValue = hidfld1.Value.ToString();
AccessDataSource1.Delete();
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
}
|
|
|
|
|
|
Hi all
I use two RequiredFilledValidator and a button in LoginPage .
When i press the button an error occured that the message is:
"Microsoft JScript runtime error: 'WebForm_PostBackOptions' is undefined"
What is your ideas about this problem?
|
|
|
|
|
|
Ive created a pretty big ASP.NET app which does financial calculations and the like. It worked fine all the way through development. What I failed to try during dev though was what would happen with more than one set of values. It breaks down to a treacle like speed. Now up till now, the dedicated server that I tested it on, ran it MUCH faster than running it in VS2008. But then it all changed, and now its slow as hell. Its a set of 5 AJAX update panels which each run according to what you press. Now as far as I can tell, the code is executing pretty speedily, but what slows it all down is the transfer of that to the client browser(maybe why it runs faster locally?).
So, is it possible that every time one of my updatepanels(all set to conditional with children as triggers) is updating, that it is also resending all the data in the others?
Thanks.
P.S. I know this is very vague, but theres far too many factors to be able to post one block of code :-/
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
If you are using the Microsoft AJAX UpdatePanel, or any derived from it, then yes, it is sending far to much data in the postback. Although only the one portion of the page is being refreshed, it still follows the typical page lifecycle, to a certain extent at least.
You can try using PageMethods or other more direct Ajax methods.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I think if you use updatepanel everything else in the page will need to send back to the server doesn't matter they are in the same update panel or not. use web service to refresh data will be better?
Still a newbie.. learning
|
|
|
|
|
|
Hi,
I am trying to add a validator callout extender programtically within a control class.
The textbox and submit button are showing, but no callout appears when the textbox is left blank.
Any ideas?
Thanks, James
//add textbox
TextBox textbox = new TextBox();
textbox.Text = (string)value;
textbox.ID = "NameField";
Controls.add(textbox);
//add required field validator to textbox
RequiredFieldValidator req = new RequiredFieldValidator();
req.ErrorMessage = "Please enter a name";
req.ControlToValidate = textbox.ClientID;
req.Display= ValidatorDisplay.None;
req.ID = Guid.NewGuid().ToString();
Controls.Add(req);
//add update panel
UpdatePanel updatePanel = new UpdatePanel();
updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
//add submit button into update panel
Button button = new Button();
button.Text = "Save";
button.ID = "SubmitButton";
updatePanel.ContentTemplateContainer.Controls.Add(button);
// add trigger into updatepanel that is fired from button
AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
trigger.ControlID = button.ClientID;
updatePanel.Triggers.Add(trigger);
Controls.Add(updatePanel);
|
|
|
|
|
Hi
I have gridview, which compares a value from a field in the gridview. If in the comparison, the values are not the same, it inserts a new row along with a label, i.e. it makes a group. All this works fine. Now, I need to show the number of rows for group. I have achieved part of goal by creating a hashtable.
The problem I have is that a new row can only be inserted when a new group has been identified in the comparison, therefore I am struggling to find a way to add my count, because the insertion comes before the count has completed. Is there away in which after the row has been added and all of the rows that belong to that group have been identified to then to go back to that header and add to the total before go onto the next group?
I have had ago but I am struggling on this and in desparate need of expert help?
|
|
|
|
|
Hi,
How to open document in asp.net ??
document fetch from server location and i want edit tat document and update it.
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
|
|
|
|
|
You can only create a link to the document and allow the registered application for the document type to open. ASP.NET itself can't be used to directly edit the document.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
then any alternatice solution is there???
Please help me
Yours,
KaNNaN
-----------------------------------------------------------------
"Success is When Ur Signature Becomes An Autograph"
|
|
|
|
|
Alterative? Yes, you could give up this career.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello,
I am using the Visual Studio Web Developer 2008 for programming in VB.NET and i have some problems:
1. Sometimes it stops highlighting the text.
2. Is there an option to refresh the Intellisense of the page?
3. When i am including files to my page, its say variable undefined.
Global information:
* I am not using the *.cs files.
* I am not using any .net button (example: asp:input...)
* I am using the include file. (example: include virtual=...)
If someone have any idea on how to fix this problem it will help me.
If not, Maby someone can suggest another program (with Intellisense)?
Thanks,
Roy Shoa.
|
|
|
|
|
In my gridview, I want to count the number of times each value (based of course on a field in my gridview) occurs. For example, if I have a field called Dept, in my result there is the following:
Dept A
Dept A
Dept A
Dept B
Dept B
Dept C
What I am trying to do is to show that for each Dept A, the count is 3, and for Dept B, the count is 2 and for Dept C the count is 1. When I have my count, I want to save them into my hidden field, which I am going to use else where in my code.
Here is my code:-
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Table tbl = e.Row.Parent as Table;
TableCell cell = new TableCell();
CheckBox chk = new CheckBox();
Label lbl2 = new Label();
HiddenField rowValue = new HiddenField();
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Visible = false;
}
else
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lbl = (Label)e.Row.FindControl("lblValue");
string str1 = ((Label)(lbl)).Text;
string prevStr= (string)Session["previousStr"];
if (prevStr== str1)
{
counter = RememberDeptCount(str1)
}
else
{
prevStr= sr1 ;
Session["previousStr"] = prevStr;
counter = RememberDeptCount(prevStr)
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
rowValue.ID = "hdnNumRows";
rowValue.Value = counter;
lbl2.Text = Convert.ToString(counter);
cell.ColumnSpan = this.GridView1.Columns.Count;
cell.Width = Unit.Percentage(100);
cell.BackColor = System.Drawing.Color.Aqua;
HtmlGenericControl span = new HtmlGenericControl("span");
span.InnerHtml = prevStr;
cell.Controls.Add(span);
cell.Controls.Add(chk);
cell.Controls.Add(lbl2);
cell.Controls.Add(rowValue);
row.Cells.Add(cell);
tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
}
}
}
}
}
public int RememberDeptCount(string dept_name)
{
if (hash_dept.ContainsKey(dept_name))
{
int current_count = Convert.ToInt32(hash_dept[dept_name]);
hash_dept.Remove(dept_name);
current_count+=1
hash_dept.Add(dept_name, current_count);
return current_count;
}
else
{
hash_dept.Add(dept_name, 1);
current_count = 1;
return current_count
}
}
When I run the code in debug mode, and look at my counts being returned for each dept I am seeing the correct results. Unfortunately, when it comes to be shown as labels in each of the groups, I am not seeing the correct results. For example, I am currently seeing 1 for each group, not 3, 2, 1.
Can anyone please help me, I am really stuck?
|
|
|
|
|
Learn how to format the code you include in your post. No one is going to read this mess.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi there,
I have a login.aspx which has a login control which works fine using Form Auth using SqlMemberProvider
<location path="Secure">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="~\Secure\ViewOrder.aspx" />
</authentication>
<sessionState timeout="30 /sessionState>
<authorization>
<allow users="*"/>
</authorization>
<membership defaultProvider="SqlMemberProvider">
but now I want to add in a Autologin page which takes a username query string and automatically authenicate the user.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If page.querystring("username") = "" Then
Response.Redirect("Login.aspx")
Else
Dim username As String = page.querystring("username")
Dim mu As MembershipUser = Membership.GetUser(username)
If Membership.ValidateUser(username, mu.GetPassword()) Then
If page.querystring("ReturnUrl") <> "" Then
FormsAuthentication.RedirectFromLoginPage(username, False)
Else
FormsAuthentication.SetAuthCookie(username, True)
Response.Redirect("~\secure\vieworder.aspx")
End If
Else
'some action if failed
End If
End If
End Sub
but don't know why the Response.Redirect("~\secure\vieworder.aspx") redirects me back to the original login page.... looks like the setauthcookie is not authenicating the passed in user properly?
any help would be appreciated.
thanks,
Still a newbie.. learning
modified on Sunday, January 24, 2010 6:04 PM
|
|
|
|
|
Learn how to format the code you include in your post. You won't get much help unless people can read what you've posted and you following the rules here.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Can you please make sure that whatever code you are putting are inside the code block tag, before posting the thread? This will help to fix the problem soon.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
sorry about that.. have fixed my previous post layout.. hopefully someone can give me some helps?
cheers,
Still a newbie.. learning
|
|
|
|
|
Any help anyone?
thanks,
Still a newbie.. learning
|
|
|
|