|
Hi I have a problem with binding parameters to an update command for an asp:SqlDataSource. The problem is when I am trying to bind a ASP:CheckBox field.
I have this definition
<asp:FormView ID="HomeListingForm"
runat="server"
DataSourceID="SqlHomeListing"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None"
BorderWidth="1px" CellPadding="3" CellSpacing="2" GridLines="Both"
DefaultMode="Edit"
>
<EditItemTemplate>
<table>
…………….
<tr>
<td >
<asp:CheckBox ID="ckMealsAvailable" Text="Meals Available" Checked ='<%# Convert.ToBoolean(Eval("MealsAvailable")) %>' runat="server" />
</td>
<td >
<asp:CheckBox ID="ckPrivateLivingArea" Text="Private Living Area" Checked ='<%# Convert.ToBoolean(Eval("PrivateLivingArea")) %>' runat="server" />
</td>
</tr>
</table>
---------
</asp:FormView>
<asp:SqlDataSource ID="SqlHomeListing" runat="server"
UpdateCommand ="UPDATE HomeListing SET AddressLine1 = @AddressLine1, AddressLine2 = @AddressLine2, City = @City, PostalCode=@PostalCode, ProvinceId = @ProvinceId, PrivateLivingArea = @private_living_area WHERE ListingId = @ListingId"
ConnectionString ="<%$ …….. %>" >
<UpdateParameters>
<asp:FormParameter Name="AddressLine1" Type="string" FormField="AddressLine1" DefaultValue =""/>
<asp:FormParameter Name="AddressLine2" Type="string" FormField="AddressLine2" DefaultValue = "" />
<asp:FormParameter Name="City" Type="string" FormField="City" DefaultValue =""/>
<asp:FormParameter Name="PostalCode" Type="String" FormField ="PostalCode" DefaultValue =""/>
<asp:FormParameter Name="ProvinceId" Type="Int32" FormField ="Province" DefaultValue ="0"/>
<asp:FormParameter Name="private_living_area" FormField ="ckPrivateLivingArea" Type="Int16" />
<asp:SessionParameter DefaultValue = "0" Name="ListingId" Type="String" SessionField="ListingId" />
</UpdateParameters>
</asp:SqlDataSource>
I am getting this error; Cannot insert the value NULL into column 'PrivateLivingArea', table 'RentalProperty.dbo.HomeListing'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
I know what it means but I can not figure out how to bind this checkbox field to the query parameters
|
|
|
|
|
Hi there,
The Eval method supports one-way (read-only) binding, here there are two options:
+ You can use the Bind method which supports two-way databinding instead of the Eval , you can read more about this in MSDN[^].
+ You can create a handler for the Updating event of the SqlDataSource control, in the method you can query the value of the check box and pass it to the input paramaters of the command.
|
|
|
|
|
Hi Everyone
I have my application in ASP.net and C#. I want to print datagrids on one of the ASP.net pages as a well formatted report. Could anyone please guide me how to go about this?
Thanks a lot in advance
Dipty
|
|
|
|
|
you have two options either put the grid which you want to print on a different page and on click of print open that page as a pop up and print view and on that page write a javascript function for printing it.
Or you can put grid in a div on same page and call print in javascript on same page.
|
|
|
|
|
Hello,
We trying to build the complete Member ship and Role management system in our website and build this functionality into our website for the Admin role rather using the ASP.NET Configuration thats comes default with VS 2005.
In Visual Studio 2005 for any website we can create and manage Users and Roles through the ASP.NET Configuration tool under the "Security" tab. How do I bring the same functionality of the entire "Security" into our website? I.e in other words creating a web page with the same functionality that the "Security" tab has.
Could some one help me to direct me where and how do I start building an Admin page to have all the functionalities like Creating Users, Mangeing Users, Creating Roles and Mnaging Roles, and defining access Rules etc..
Is there an article to go through to understand it?
thanks in advance,
-L
|
|
|
|
|
It's odd that Microsoft didn't include controls for membership management, or a (supported) means for using the ASP.NET management tool for production sites. It may be that's coming along later.
For the time being at least, you can build your own using the methods exposed by the Membership class[^].
Peter Kellner has a good article on this on MSDN (and his own site):
Microsoft ASP.NET 2.0 Member/Role Management with IIS[^] that you might want to check out.
|
|
|
|
|
Hi,
I have developed an web application using Visual web developer 2005 express edition. The application is working fine in development enviornment but in production which is the IIS 5.0 web server in windows 2000 Prtofessional operating I am not able to access the site.
I am using MS SQL Server 2000 as database.
can any one help me out to solve the problem.
Thanks & regards,
Praveen Goutia
|
|
|
|
|
Praveen02101980 wrote: I have developed an web application using Visual web developer 2005 express edition. The application is working fine in development enviornment but in production which is the IIS 5.0 web server in windows 2000 Prtofessional operating I am not able to access the site.
Do you have .NET 2.0 installed on the production server? Is the Web site on the production server set to use .NET 2.0 instead of 1.x?
Jon Sagara
Look at him. He runs like a Welshman. Doesn't he run like a Welshman? Doesn't he? I think he runs like a Welshman.
My Site | My Blog | My Articles
|
|
|
|
|
Hi,
I have installed .NET 2.0 on the production server and also configured to use ASP.NET 2.0.
The First page of the application is opening but all application is not able to access MS SQL Server in production environment.
|
|
|
|
|
Have you checked that the connection string that you are using has permissions to connect the database in the production server ?
Are you using Windows Integrated Security ?
/// -----------------------
Braulio Díez
http://www.bdiez.com
/// -----------------------
|
|
|
|
|
i want to start learning CrystalReport in asp.net(C#) but i dont know how should i start???????
can any body help me?????
can u tell me a refrance???????
|
|
|
|
|
Google for "crystal reports tutorial" perhaps?
Here's the Tutorials and Sample Code[^] listing for Crystal Reports/Visual Studio 2005 on MSDN.
|
|
|
|
|
in vs2005, how do you create page events for c#?
i used to use the dropdown list of page events from the GUI of vs2003
|
|
|
|
|
There is a list in the help section.
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref13/html/T_System_Web_UI_Page_Members.htm
I haven't figured out how to add them without typing them out either. It was easier in VS 2003. Maybe we are missing something.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Hi there,
Because the changes in ASP.NET 2.0 and the web pages now support auto event wire-up, so you can add the handler for an event of the Page instance by declaring the method in the naming format Page_event[^], for example Page_Load , Page_LoadComplete ...In Vs 2005, you can still add the event handlers using the Properties Window, however i don't think this is the official way to do this, but it's worth a try:
+ Open the web page .aspx in the design view, right click and choose View Component Designer. You can also choose this from the menu View|Component Designer.
+ Select the Properties Window in the left pane, select the code-behind class in the dropdownlist, then choose the event icon.
+ You now can add the event handler for a specific event of the class, VS 2005 will automatically add the code to wire up the event handler in the InitializeComponent method. And you need to manage to add the call to the InitializeComponent method since the VS 2005 does not do that for you, you can add to the overriden OnInit or OnPreInit .... method:
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
|
|
|
|
|
Hello every one.
I'm using Response.Write in the Page_Load event to write a JavaScript and open a new windows if querystirng id parameter was providet.
But when i do this my Theme/css looks wiered, colors are right but tekst size are wierd and to large, on top of each others and so on...
Start of html coden when JavaScript was written and site looks crapy:
<script language="JavaScript"> window.open("survey.aspx?id=20&company=luc", "Survey", "toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=520, height=450");</script>
<!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><title>
-------------------
and without and site looks great:
<!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><title>
--------------------
Any idears why, or is the a page event i can use to response.write the code after all other html stuff is written insted of the top of the document?
Thx in Advance
|
|
|
|
|
When you put stuff before the doctype tag it gets ignored by the browser. That means that the browser is working in quirks mode instead of in compatibility mode. All standards go out the window and you end up with a browser that basically tries to work as badly as possible...
Use the RegisterStartupScript method to add the script to the page.
---
b { font-weight: normal; }
|
|
|
|
|
Nice works like a charm.
Thx alot
|
|
|
|
|
I am basically requesting a page from the server without opening it in a browser. The following code works fine, however for some weird reason, if i add parameters to the end of the url (such as: ?ID=2), it gives an error on req.GetResponse.
string url = "http://localhost/radar.net/Administration/main.aspx?id=2";
WebRequest req = WebRequest.Create(url);
WebResponse resp = req.GetResponse();
If it was main.aspx on its own, then it works without errors. Cant i send querystring parameters when requesting a page through this object? Does anyone know why this could be a problem????
ZiggY.
|
|
|
|
|
Standard question #2:
What error message do you get?
---
b { font-weight: normal; }
|
|
|
|
|
This is the error im getting:
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error
ZiggY.
|
|
|
|
|
That means that there was an error when executing the page that you are requesting. Browse to the page with the url you are using so that you see the complete error message.
---
b { font-weight: normal; }
|
|
|
|
|
What is the error you're getting? I've used querystring parameters this way without problem. Is it possible the page main.aspx is erroring?
|
|
|
|
|
This is the error im getting:
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error
No, im sure there's no error in the main.aspx page. It runs fine if i open a new browser and run the link normally (even with the querystring). Only when i send it as a request through the webrequest object i get an error... how come?
ZiggY.
|
|
|
|
|
ZiggY81 wrote: The remote server returned an error: (500) Internal Server Error
Well, I don't know what to tell you then. The 500 error you are getting is happening on the web server - maybe it is an authentication issue? Do you need to send credentials with your WebRequest?
|
|
|
|