|
I'm having quite the bizzare issue. I created a page a while ago which validates my form using javascript and if everything looks good, then it issues a post back passing the 'submit_button' as the posting control and 'validated' as the argument. This works just fine, however I copied the page to a new form and made some slight modifications to the javascript, images, and layout on the page, however both pages are using the same "validate_form" function but the new page that I copied over always throws the "invalid post back or callback argument". I've scoured the net for the better part of this day and have come across the clientscript.RegisterForEventValidation method but cannot seem to get that to work. But...again what is bizzare is why it's not giving me this error on the first page I made months ago as there's no code disabling the validation for the page.
I've tried this so far, but still get the error:
protected override void Render(HtmlTextWriter writer)
{
this.ClientScript.RegisterForEventValidation("submit_button", "validated");
base.Render(writer);
}
What's also weird is when I debug on the Page_Init event, I can look at the live "Validators" collection but even after the RegisterForEventValidation() executes, I still get a collection count of zero. Am I looking in the wrong place?
Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
Ah, after looking at this http://forums.asp.net/t/945348.aspx I did find that it's a drop down list control causing the error. The control appears to be alright, but because I'm adding option values using javascript that's what's causing the invalid argument error. I'm still curious if there's a way using the debugger I could have found out which "argument" or control post back was causing the error quicker. Anyone have any suggestions?
Thanks!
Knowledge is not power, however, the acquisition and appropriate application of knowledge can make you a very powerful individual.
|
|
|
|
|
I need to validate date in textbox using javascript..
The date is must be not greater than TODAY date and not less than before 3 months ..If either of these conditions is fails will show the prompt message..
please any body help
|
|
|
|
|
What you have tired till now ?
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Get the current date using getDate method. Then using the methods available with the date object and some maths, you can do this. Try out something. If you get stuck, post the query.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi,
Please provide me the code of adding checkbox control in Gridview at runtime.
Thanks & Regards
Care Career
|
|
|
|
|
Code demands is considered a bit rude here. What have you tried? Where are you stuck exactly?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
|
Hi, i have a catalog with 1 web part in it. This web part contains a drop list and an iframe. onchange of the drop list I refresh the iframe to a new src. When I add the same web part twice on the same page and change one drop list, it refreshes both iframes. is there a way I can reference the current instance of the web part when doing this?
Thanks,
The code for my control is below.
<%@ Control Language="C#" ClassName="reportViewer" %>
<script runat="server">
[Personalizable]
public string Model
{
get
{
return DropDownList1.SelectedValue;
}
set
{
this.DropDownList1.SelectedValue = value;
}
}
[Personalizable]
public string ModelURL
{
get
{
return reportV.Attributes["src"];
}
set
{
this.reportV.Attributes["src"] = value;
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string reportUrlBase = "http://localhost/ReportServer?/EMIS+Demo+St+Josephs/Customer/dsh_CUSUM&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&rc:Toolbar=false&SiteID=a0136a37-b5c2-45bc-b846-15ed103c7e89";
string newUrl = reportUrlBase + "&Commodity=" + DropDownList1.SelectedValue.ToString();
this.reportV.Attributes["src"] = newUrl.ToString();
}
</script>
<asp:Label ID="Label1" runat="server" Title="CUSUM">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
Choose Model:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="fbc4e320-dd15-448f-84a8-40c50bb27f03">Site Gas Daily</asp:ListItem>
<asp:ListItem Value="74c9fc13-9920-4d67-8e9d-52cfb8076d3a">Site Elec Daily - Weekdays</asp:ListItem>
<asp:ListItem Value="3555ff80-b57e-410a-9295-82846d4a0a10">Site Elec Daily - Weekends</asp:ListItem>
</asp:DropDownList>
<br />
<iframe id="reportV"
src="http://localhost/ReportServer?/EMIS+Demo+St+Josephs/Customer/dsh_CUSUM&rs:Command=Render&rs:Format=HTML4.0&rc:Parameters=false&rc:Toolbar=false&SiteID=a0136a37-b5c2-45bc-b846-15ed103c7e89"
runat="server" style="width: 370px; height: 305px" Title="CUSUM"/>
<br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</asp:Label>
|
|
|
|
|
Hi,
Please provide me an example for passing authentication details in SOAP header through .NET 2.0 to Axis web service.
Thanks in advance
Ajay
|
|
|
|
|
Read this[^]
only two letters away from being an asset
|
|
|
|
|
Hi to every one...
I am developing a small ASP.NET application. It has a page where visitor can post comments, a page for the administrator to view posted comment. I display the comments on a (data) Repeater control with two checkboxes for each record to either mark posts as read or to delete the post; with both enabled property set to true.
For a test, I added a label to tell me the selected (checkbox) item. But each time I check any of the checkboxes, I don't get the expected result. This is my code-behinde file under the Page_Load event handler:
For i As Integer = 0 To rptPosts.Items.Count - 1
Dim row As RepeaterItem = rptPosts.Items(i)
Dim isRead As Boolean = CType(row.FindControl("chkRead"), CheckBox).Checked
Dim isDeleted As Boolean = CType(row.FindControl("chkDelete"), CheckBox).Checked
Dim MessageLabel As Label = CType(row.FindControl("lblMessage"), Label)
If isRead Then
MessageLabel.Text = "Read checked"
ElseIf isDeleted Then
MessageLabel.Text = "Delete checked"
End If Next
Please help me out.
Tunsten
|
|
|
|
|
Where are you binding the items to this Repeater? Is it before this code? You are most likely rebinding the Repeater and thus erasing all the changes that were made on the client-side.
only two letters away from being an asset
|
|
|
|
|
Thanks for your reply.
I am binding with a DataSet under the form_load event handler.
What I want this to take effect at the click of the check box attached to the specific record.
Can I also confirm from the user before the update or deletion could take place?
Thanks.
Tunsten
|
|
|
|
|
tunsten wrote: I am binding with a DataSet under the form_load event handler
How? You haven't shown any code. Possible like this
if(!IsPostBack)
{
Repeater.DataSource = ...
}
Previous code...
tunsten wrote: Can I also confirm from the user before the update or deletion could take place?
Yes, use the javascript confirm method
tunsten wrote: I am binding with a DataSet under the form_load event handler.
Seems like you have far too much code in the page load
only two letters away from being an asset
|
|
|
|
|
Hi,
I am a newbie in asp.net. I am trying to connect a sql database with my web page. I have got a checkbox and a button on the page, once the check box is checked and the button is clicked the page should show the data that I want from the database table. I have written so far the following codes.
<
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (CheckBox1.Checked)
{
SqlConnection conn = new SqlConnection("user id = user;" +
"password = pass;" +
"Data Source = local host"); //making the connection string
conn.Open(); //opne the connection
SqlCommand cmd = new SqlCommand("SELECT (id, name) FROM customer", conn);//sql query
conn.Close();//close the connection
}
}
}
>
It doesn't work. I get the following error msg.
<
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
>
The datasouce is not right ! . I would really be appriciated if some can give an idea how can I fix it or the way I am trying to do it if it's right. Many thanks in advance.
|
|
|
|
|
Take a look at this page http://www.connectionstrings.com/
|
|
|
|
|
hi
in a page when i click on a button then a pop-up page is shown to the user
now what is the problem is if when user blocks the pop-up page for my website then he cant able to see the pop-up page.
i saw that by default the pop-up blocker is set to turn off for internet explorer
how can this problem is solved
|
|
|
|
|
Nothing much. Apart from checking that the window you had popped up, opened or not. You can check this through window.open("popup").closed property.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Check, if you can try with <a href with target as _blank in your scenario.
|
|
|
|
|
I m done a web page in ASP.NET. The Web page is finished. know I m facing a problem.
When i execute my web page in different system web page is will not coming in middle or it is not expand to screen size.
and Zooming process also same problem is coming.
I tried following thing.
1. Set margin: Auto; and margin: 0px auto;
2. text-align as center in div, p, span tag. aslo I tried Center tag.
How to solve this problem.
modified on Wednesday, October 21, 2009 7:53 AM
|
|
|
|
|
How did you fixed the widths of the controls in your page?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
I m using DIV tag and set margin, Padding, Width, Height etc..
|
|
|
|
|
|
What u given suggestion is working improperly in IE but in Mozialla not working for my code is any other solutions?
|
|
|
|