|
Set a break point in the code and step through to see where this exception is being thrown.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Thank you both for your answers.
Actually, break points couldn't help me because the application did well on my computer(localhost), the error occurred only when I tried to run it on the server, so I used a try-catch block, captured the exception and inserted it to my database. btw, the error was about file permissions (I had to give the aspnet and network-services accounts read,write & execute permissions)
|
|
|
|
|
hi friends
i am using visual studio 2008.
i have added a master page and some content pages i need to know how to add Jscript file in content pages and how to invoke the functions of the Jscript on the click of a button...
in these content pages there is not html tags at all so how to do it
can anyone plz help me in this issue
K.Gayathri
|
|
|
|
|
This may help[^]
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
MalarGayu wrote: in these content pages there is not html tags at all
Impossible. If you had no controls at all then the page would be blank, empty. Is it?
Without seeing the Content placeholders you have it would be difficult to answer accurately for your situation. However, typically there is a content placeholder for additional header information where you place link or script elements that should be including in the head for that page. Otherwise you would need to add them to your masterpage.
No comment
|
|
|
|
|
hi friends
this is my content page*********************
<%@ Page Title="" Language="C#" MasterPageFile="~/CampaignLayout.Master" AutoEventWireup="true" CodeBehind="Campaign.aspx.cs" Inherits="MailingCampaign.Campaign" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
put contents for campaign</asp:Content>
i need to adda JScript file seperately and write a function in it and call it in this content page
button click even so how to do it
K.Gayathri
|
|
|
|
|
As I said, you would add the script element pointing your JavaScript file in the header content placeholder, cphHead in this case. Then you can make whatever JavaScript calls necessary since the script will be available on the page when it is rendered on the client.
Always make sure to format any code snippets properly when submitting. Edit you post to correct this.
No comment
|
|
|
|
|
hi friend
i wrote the javascript and called it but actually my textbox name which i am passing as parrameteris <b>txtListname </b>but when i give like this only it is working so how to solve this problem
content page***************
<asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" OnClientClick="return Validate(ctl00$cphMain$txtListname)"
Text="Submit" TabIndex="15" />
javascript*******************
<script type="text/javascript">
function Validate(ctl00$cphMain$txtListname)
{
if (ctl00$cphMain$txtListname.value == "") {
alert("you must enter the List name");
return false;
}
}
-- modified 8-Nov-11 19:05pm.
|
|
|
|
|
I dont understand exactly what you are asking but I am going to assume your bit of code is not working. I am not sure what you think ctl00$cphMain$txtListname is but it's not a control that you can treat like you are trying to do.
if you step through your javascript you will most likely find that ctl00$cphMain$txtListname is marked as undefined. that is because it is the id of the element and nothing more.
maybe this little snippet will give you a small bit of insight though:
snippet[^]
hope it helps explain things a bit.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
what I typically do is add a ContentPlaceholder at the bottom (right before the closing body tag in my MasterPage.master.
this way in my content pages I have a that last content placeholder that I can use for adding script code to.
if you don't want to do that then at the bottom of your content placeholder all you have to do is add a script block.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
hi dennis
thanks for the reply
but plz do read my latest thread to know about my issue.....
now i know how to write javascript but i have another issue which i have mentioned in the latest thread of mine...
K.Gayathri
|
|
|
|
|
According latest post in the thread, You actually need to pass the ClientId of your textbox into the validate method. And your method should be like
function Validate(txtClientId)
{
if (doucment.getElementById(txtClientId).value == "") {
alert("you must enter the List name");
return false;
}
}
and you can call the method on aspx page
Validate("<%=txtListname.ClientID %>")
|
|
|
|
|
thanks for the reply
it is not working for me
hey the textbox is a webcontrol textbox....is it any problem for this
it is not identifying the textbox id...
K.Gayathri
|
|
|
|
|
hi
i need to specify you all friends that my textbox is placed in a content page inside content placeholder so i need to access the id of that textbox placed inside the contentplaceholder
K.Gayathri
|
|
|
|
|
MalarGayu wrote: the textbox is a webcontrol textbox....
I dont think that this is a issue.
Is your button, textbox are on the same content page?
One other way is, Register a javascript variable and assign the ClientId of textbox from Server side (C# code) and use that variable to get the ClientId of textbox in the validate method.
|
|
|
|
|
Since I am new to working on C# webforms 2010, I have the following questions to ask so I can understand what is occuring in the following code:
1. In the code listed below, what does the '|' mean in the line 'rowState | DataControlRowState.Edit'? In addition can you explain what is occuring in the line of code for <pre> 'row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);'
protected override GridViewRow CreateRow(int rowIndex, int dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState)
{
GridViewRow row;
if (this.BulkEdit)
row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);
else
row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState);
return row;
}</pre>
2. In the aspx file, I see the following Namespace="BulkEditGridView". Can you explain or point me to a reference show I can understand how the "BulkEditGridView" namespace is wired into making the webpage work?
<pre>
<%@ Page Title="" Language="C#" MasterPageFile="~/ModuleBase.master" AutoEventWireup="true" CodeBehind="Manage.aspx.cs" Inherits="Support.Manage"
<%@ Register Assembly="Support" Namespace="BulkEditGridView" TagPrefix="test" %> </pre>
3. When I step through the code, I see the following items being referred to in the .aspx file. Can you explain what is occurring?
<pre>
<ItemTemplate>
<asp:CheckBox ID="chkL" OnCheckedChanged="CheckRoleChanged" AutoPostBack="true"
Checked='<%# Convert.ToBoolean( Eval ("L")) %>' runat="server" />
</ItemTemplate
</pre>
The code is called from ' row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);' that was listed above.
|
|
|
|
|
classy_dog wrote: what does the '|' mean
It is a bitwise OR of the two values.
classy_dog wrote: can you explain what is occuring in the line of code for <pre> 'row = ...
Are you asking about the pre tag or the function call to CreateRow?? I am assuming it is about the tag since the other code seems to be fairly self documenting.
pre tag explained here[^]
Namespaces and their explanations is something you can google and get all sorts of information.
google c# namespaces[^]
classy_dog wrote: I see the following items being referred to in the .aspx file
I am unclear what you mean by referred to?? That is a part of the gridview that you have defined in your code.
I don't mean to pry or sound rude but the level of your questions in consideration with the code you have written leads me to wonder if all this is for a code interview you are taking part in. It just seems odd that you have all this stuff created yet you know so very little about it.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
The following is in response to the answers that you provided so far:
1. Thank you very much for your answer for the bitwise operator.
2. I did NOT wirte this code. This is code in another part of company website. I need to write similar code in a new webpage for the company. I was just promoted to this position in my company. There are no other programmers here.
3. I am trying to understand this code so I can write code were data connects to the formview control. When looking online, microsoft recommends using a datasource control to directly connect with a web form control. However a datasource control like linq to sql will not work for me. My data will come from 2 tables that are not related and what users select in several dropdownlist boxes.
Thus can you show me how to bind data to a formview control, where the data comes from several different locations?
|
|
|
|
|
sorry it just seemed so weird...
ok so you have one control that you want bound to two different data sources?? sounds kind of crazy and my recommendation would be for your server code to pull the two pieces of information together into a single source that can be bound on your page.
are your two different tables in the same sql server??
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
I want to let you know that I appreciate your help!
The following explains what I am doing in the process:
1. There are two pages that I will explain (the page not mentioned is just a summary page)
The first page (which I already completed) is where the user selects company, several dates, and all applicable subcompanies. A row was inserted into the 'master' table. The user click the next button, and now the user is on the second webpage that I am working on.
2. On the second web page, I need to display the following on the formview or possibly a detailsview
control in the following different stages:
a. stage 1 is what was entered on the first webpage into the web control. I also need to display the organization name. I can get the previous page information from the row that was just inserted into the master table. However the organization name is not a column in the 'master' table. The organization name is a session varirable I can pass. However, I need to bind that 'organization name' to the web control somehow. This what I am looking for.
b. stage 2 the user is going to select a payment month and year from a dropdownlist control embedded in the detailview or formview control. At that point, values from a schedule due date table will populate more date fields in the webform control.
There are more stages, but they are not relevant right now.
**In answer to your question, yes the tables are on the same database server. However the two tables are on different namespaces in different datacontext objects.
|
|
|
|
|
if all (99%) of your information can come from that one table and all you need to do is to associate a session variable then do that. I am not sure if you are aware of this but you can embed session variable values into a page.
<p>
the value of my session variable variableName = <%=Session[variableName] %>
</p>
does that help??
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
All of your answers definitely help!
I do want to metnion the following:
1. The information comes from two tables and what the user enters.
2. can you bind a session variable to a detailviews control somehow before you call the databind method for the detailview control?
3. Can you accomplish what I am trying to do on one webpage or would you break the stages I listed previously to being generated on separate pages?
|
|
|
|
|
classy_dog wrote: 2. can you bind a session variable to a detailviews control somehow before you call the databind method for the detailview control?
Yes, you can bind a control whether it's a part of detailsview control or just on the form to a session variable.
<asp:Textbox runat='server' ID='txtBoxControl' Text='<%=Session[varname] %>' />
the code <%=Session[varname] > is run when the page is rendered and is being sent to the client browser.
classy_dog wrote: 3. Can you accomplish what I am trying to do on one webpage or would you break the stages I listed previously to being generated on separate pages?
One web page but it requires some 'magic'... =)
all of these separate web pages you are talking about can really be inside of their of own div and then you can stack them like a deck of cards by controlling the css display property. you can simplify your client side development with some jQuery which might make your world a little easier.
you have to remember though that each time you are going back to the server is a post and get operation. in my opinion you want to minimize these transactions as much as possible.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Thank you very much! You have definitely answered all my questions! When I have more experience, I plan to answer questions like you do. This way, I will be able to help others!
|
|
|
|
|
ALways wrap your code in "pre" tag to give better readability to user.
|
|
|
|