|
Thanks for the suggestion griff.
I have removed the web.config and once again i referred all my tools/controls i have used in the application. But what the miracle is amoung two of my development server.
It works in one server but not in my local system.
Anyway i will try again the same option and close the issue.
Thanks once again Griff.
|
|
|
|
|
palvesh wrote: Thanks for the suggestion griff.
I am not Griff.
palvesh wrote: It works in one server but not in my local system.
So, you need to check what is different between the two systems. I get the feeling you still don't understand the original error message, but cannot think of anything to make it clearer.
palvesh wrote: Thanks once again Griff.
I am still not Griff.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Richard.
Hope my question may look silly and make u to think wrong on my observation.
Richard, i got the issue exactly.
As per my error: the error message itself clearly explain and i have also sorted the issue. It's simply due to the wrong usage of namespace which refers window forms(System.Windows.Forms) in the web app page.
But what is my question is ..
How it works in one server and not in another which has the same coding/config.
Something i am missing to check other than these..
|
|
|
|
|
Sorry but I cannot answer that without seeing exactly what is on each system. Perhaps just one of those strange situations that we never manage to get an answer for.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for the response Richard,
Now i am working in a new web application created in vs2010.
I have noticed a tag in the master page and webform page.Pls explain what is the exact usage of this.
In masterpage:
<asp:contentplaceholder id="head" runat="server">
In webform:
<asp:content id="Content1" contentplaceholderid="head" runat="Server">
|
|
|
|
|
I'm afraid I am not a web developer so cannot help you on this. I would suggest the ASP.NET website for more information.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
I've never tried to put a findcontrol in a findcontrol, but in vb the + signs are still & ampersands. However, since the code in the () is javascript, the plus + signs should work, if you require a direct print of the findcontrol.
You may not have imports system.web
or you need to prefix the control
System.Web.UI.DropDownList
or something like that, I don't remember where the dropdownlist resides at.
CType(gvw.FindControl("FTddlCity"), DropDownList).Attributes.Add("onchange", "javascript:city_Visibility('" + CType(gvw.FindControl("FTddlCity"), DropDownList).ClientID + "','" + CType(gvw.FindControl("FTtxtCityName"), TextBox).ClientID + "');")
Hmm, thinking out loud.
Findcontrol is server side processed, before the html is rendered and sent back to the client. The findcontrol in the Javascript is just an ID reference to the DropDown, so the Dropdown can be called in the DOM. Your using a server side name called FTddlCity to find it on the server side, when you can just let the client side do it's thing, using the client side id.
in Jquery, you can find the id asp.net server has assigned by calling
$('[id*="_FTddlCity"]').css('background-color', txtFocus).fadeOut("normal");
If you just assign a unique ID to the Dropdown, you can just call the ID in the Javascript. This will filter over the prefix the server will assign to the ID or the control. If you want to hard code an ID, it's attributes.add("id", "FTddlCity")
|
|
|
|
|
Since I am new with working with C#asp.net web controls 2010, I have the following question to ask about the gridview control:
1. Since there a way to change the orientation of the gridview control. Instead of being horizontal orientation, I would like the the gridview control to be vertical display? This column names would go down the left side of the grid? If this is possible, what do I need to do change the orientation?
2. I want to embeded dropdown list controls in different cells. Is there a way you recommend I accomplish this task? Is there some like 'BulkEditGridView' for dropdown list controls?
|
|
|
|
|
For your first question, You can transpose your data source and can achieve what you want. Do a bit of google how to "Transpose DataTable".
For Second question, just google "bulk edit GridView" and will get 100s of result.
I am pasting one of them for you here[^].
|
|
|
|
|
Hi Experts,
I have one default template in word in which i have to include strings from textbox. Can some one provide some idea of doing it using asp.net.
I tried usingASP.NET generating Dynamic word Documents[^]
but this is given in Vb. Can some one provide me any similar solution given in the above link using asp.net.
|
|
|
|
|
I am asking the following question since this is the first few C# asp.net 2010 web form pages I am working with at my company. My problem is I want to pass the value of orgName from the code listed below to a new web page called Next_Page.aspx as a session variable. The problem is by the time I get to the method called 'submit_button', I do not have the value of 'orgName' any longer. Thus can you tell me what I need to do to have the value of 'orgName' obtain from the 'FindOrg' available to the 'submit_button' method? If the value or orgname is within the (object sender, EventArgs e) of the SubmitButton method can you tell me how to access this value?
The code listed below is all from the same web page called first.aspx.cs.
The following is the current code:
[^]protected void FindOrg(object sender, EventArgs e)
{
try
{
String strOrgSql = "";
String orgName = txtOrgName.Text.Trim();
}
catch (Exception ex)
{
//do something
}
}
protected void submit_button(object sender, EventArgs e)
{
try
{
want orgname value here
Session["orgname"] = orgname;
Response.Redirect("~/Next_Page.aspx");
}
catch (Exception ex)
{
// do something
}
}
[^]
|
|
|
|
|
orgname is a variable local to the FindOrg method. It can't be used outside of that method. Use txtOrgName.Text.Trim();
No comment
|
|
|
|
|
How would I declare the variable so I can use it outside of this method? Would I set it up as a session variable?
|
|
|
|
|
You can put the variable at Class level. You can also put it in session variable and can be accessed at any other pages as well
|
|
|
|
|
In the case you have shown you don't need to use a variable to hold the value until it is passed to session, assign the value from the control directly to you e session variable
Session["orgname"] = txtOrgName.Text.Trim();
No comment
|
|
|
|
|
I am wondering if my plan listed below is a good idea or bad? If it is a bad idea, can you tell me why it is not a good idea and what would you do differently like use a different asp.net 2010 control?
Also, I am wondering if using a gridview control would be a better option. If so, can you tell me why it is a better option and/or point me to a link (url) that I can use as a reference?
The plan so far is:
I am setting up a new C# asp.net 2010 webpage. In this particular webpage, I need to have rows that just show up if a user clicks like 'y' in a webpage. Basically some default dates will be displayed and the user will be asked if the date is not valid. If they say the date is not valid, then I would like an extra row to show up for the user to enter the correct date. After the user enters the correct date, then the extra row (or cell) will go away from view once the application has verified that the date they entered is correct.
I am thinking of placing this kind of setup in a asp.net table control. The row that will show up that will allow a user to enter the correct date, will have it's property set to not visible by default. However when the date needs to be entered by the user, the visible property of that row will be set to visible and the user will be ableto enter the date. Once the date is entered, the visible property of that row will be set to false again so the row does not show up again.
Also the rows in this table do not need to be sorted. Only one column needs to be used for editing.
|
|
|
|
|
not quite sure I understand completely so let me summarize what I think you are saying.
you are going to have a form where a user enter information. depending on where/what they enter you may want to display a table containing information 'x'.
your idea is workable and I am sure some will argue your approach is workable. if you do go that way I would put the gridview inside of div and set the css display to none.
but that leads me to another point of mine... I personally am not a fan of the gridview and prefer using jQuery and dataTables[^].
you have to do some javascript work but the table is rendered client side and you won't find yourself having to be stuck with any server side rendering.
this just my preference and like everything else in software there is I am sure another way to "skin this cat".
best of luck.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
I have a page of records and on this page there is a link that allows the user to run a report asynchronously in a separate window. Here is the relevant code:
Link in view:
<p>
@Html.ActionLink("Create New", "Create", new { claimId = ViewBag.claimId })
@Html.ActionLink("PDF Print", "PhotoBook", new { claimId = ViewBag.claimId }, new { target = "_blank" })
</p>
Photobook action in controller:
public ActionResult PhotoBook(int claimId, int? defectId, int? propertyId, int? locationId, int? categoryId)
{
var observations = db.Observations.Where(o => o.claimId == claimId);
if (defectId != null)
observations = observations.Where(o => o.defectId == defectId);
if (categoryId != null)
{
ViewBag.defectId = new SelectList(db.Defects.Where(d => d.categoryId == categoryId), "id", "displayId", defectId == null ? null : db.Defects.Where(d => d.id == defectId));
observations = observations.Where(o => o.Defect.categoryId == categoryId);
}
else
{
ViewBag.defectId = new SelectList(db.Defects, "id", "displayId", defectId == null ? null : db.Defects.Where(d => d.id == defectId).FirstOrDefault());
}
if (propertyId != null)
observations = observations.Where(o => o.propertyId == propertyId);
if (locationId != null)
observations = observations.Where(o => o.locationId == locationId);
return RedirectToAction("Index", "Report", new { observations = observations });
}
Index action in Report controller:
public void IndexAsync(IEnumerable<Observation> observations)
{
AsyncManager.OutstandingOperations.Increment();
photoBook myReport = new photoBook();
myReport.DataSource = observations;
string fileName = "Photobook " + DateTime.Now.ToString("yyyyMMddHHmm") + ".pdf";
AsyncManager.Parameters["fileName"] = fileName;
ReportProcessor myProcessor = new ReportProcessor();
RenderingResult result = myProcessor.RenderReport("PDF", myReport, null);
FileStream fs = new FileStream(Server.MapPath("~/Reports/" + fileName), FileMode.Create);
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
fs.Flush();
fs.Close();
myReport.Dispose();
fs.Dispose();
AsyncManager.OutstandingOperations.Decrement();
}
public ViewResult IndexCompleted(string fileName)
{
ViewBag.fileName = fileName;
return View();
}
Now my question is twofold:
1. Is passing the Observations collection around terribly inefficient? I could pass the query information to build the collection as opposed to the entire IEnumerable collection.
2. I want the report page to indicate to the user that something is happening before it starts processing the report. Can I return a view to the user while the IndexAsync is processing?
Cheers, --EA
|
|
|
|
|
I needed code in asp.net for changing code in second dropdown box when first is select according requriment
I mean if we selected One state in one dropdown box it should display only that particular state details in second dropdown list in both using database and without using database pls.....
|
|
|
|
|
|
hi,
I try to add my website to an Iframe, it goes well, but I can't see a flash file which exist in my site and displayed well.
my site: <a href="http://www.megalim.co.il/">http://www.megalim.co.il/</a>
the iframe website; <a href="http://www.netravel.co.il/Megalim/">http://www.netravel.co.il/Megalim/</a>
|
|
|
|
|
I am working on a C#.net 2010 application I just wrote. Right now I am getting the error
'Cannot add an entity that already exists'. I get that error on the following line of code: attPlanDataContext.SubmitChanges();
I am trying to write to a table that has one to many rows that relate to the main table. When I try to add the second row to the table, that is when the error occurs.
I am hoping you can suggest what I need to change to fix this error. The following is the code that is affected by this error:
[^] protected void submitbutton(object sender, EventArgs e)
{
if (!Page.IsPostBack)
return;
CustomerDataContext attDataContext = new CustomerDataContext();
Customer att = null;
att = new Customer();
InsertCustomer(att);
attDataContext.Customer.InsertOnSubmit(att);
attDataContext.SubmitChanges();
CustomerDataContext attPlanDataContext = new CustomerDataContext();
Plan attplan = null;
attplan = new Plan();
InsertPlans(attplan, att, attPlanDataContext);
}
protected void InsertCustomer(Customer att)
{
// fills in data here
}
protected void InsertPlans(Plan attplan,Customer att, CustomerDataContext attPlanDataContext)
{
for (int i = 0; i < ChkBoxLstPlan.Items.Count; i++)
{
if (ChkBoxLstPlan.Items[i].Selected)
{
attplan.Att_id = att.Att_id;
attplan.Number = ChkBoxLstPlan.Items[i].Value.Substring(0, 5);
// Update the database
attPlanDataContext.Plans.InsertOnSubmit(attplan);
attPlanDataContext.SubmitChanges();
}
}
}
[^]
|
|
|
|
|
classy_dog wrote: [^]
Please use <pre> tags around your code (use the code button above), to make it readable. You can correct this by editing your message.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I placed the [^] tags around my code. What did I do wrong for this post?
|
|
|
|