SqlDataSource Set SessionParameter Programatically
Sep 6, 2010
I have a StoredProcedure called "usp_posts_getall" and it has 1 parameter called "@thisCategoryID"
in my "thisCategoryID", any values other than 0(zero) will return all the records in my Posts table.
Now I have a category menu items and each time I select, I set the value in my Session name called "SelectedCID".
So, How Do I ...
Create a SessionParameter Programatically in SqlDataSource?
View 1 Replies
Similar Messages:
Oct 26, 2010
I am trying to query my SQL database via sqldatasource in my VB.NET code for my webform and would like the results to be stored in a Crystal Report parameter field so that I can then pass it to my report
View 2 Replies
Jul 20, 2010
I am trying to get an asp:SessionParameter of a SelectParameters, to use a property of an object in session
instead of having a string in the session like Session["CustomerID"]
Something like Session["Customer"] where the property is ((Customer) Session["Customer"]).CustomerID)
My code:
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:DBConnectionString %>" xmlns:asp="#unknown"> SelectCommand="SELECT * FROM getStoreCustomers (@customerID,@week,@day)"
ProviderName="System.Data.SqlClient">
<selectparameters>
<asp:sessionparameter name="customerID" sessionfield="Customer" /> ?????? (what is the syntax to pass the property here?)
<asp:controlparameter controlid="ddWeek" defaultvalue="-1" name="week" propertyname="SelectedValue" /> <asp:controlparameter controlid="ddDay" defaultvalue="-1" name="day" propertyname="SelectedValue" /> </selectparameters>
The class I use is like any other class (but serializable)
[Serializable]
public class Customer
{
public int CustomerID
{
get;
set;
}
}
View 2 Replies
Dec 28, 2010
Is it possible to pass a domain object as session parameter in an ObjectDataSource. I'm doing this:
<asp:ObjectDataSource ID="ParticipantsDataSource" runat="server" OnInit="SqlDataSource_Load"
SelectMethod="LoadParticipants" TypeName="SB.Web.units.Players">
<SelectParameters>
<asp:SessionParameter Name="user" SessionField="User" Type="SB.BusinessLogic.DomainEntity.User" />
</SelectParameters>
</asp:ObjectDataSource>
But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.
View 1 Replies
Jan 11, 2010
I have FormView that has a DropDownList
this DropDownList takes its list from a sqldatasource that has SessionParameter as parameter.
after loading the page if i changed the value of the session an error get fired !!
the Error is "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
When i click on the GOOOO button the error occures
My Code is
[Code]....
My other code is
[Code]....
View 9 Replies
May 14, 2010
I am trying to tie a sqlDatasource to a Stored Procedure. The stored procedure looks like...
[Code]........
View 2 Replies
Oct 23, 2010
I have a div with an id of "test" and runat="server"
Can I change the opacity of this div in the code behind, and if so how?
View 4 Replies
May 5, 2010
we have a situation where we log visits and visitors on page hits and bots are clogging up our database. We can't use captcha or other techniques like that because this is before we even ask for human input, basically we are logging page hits and we would like to only log page hits by humans.
Is there a list of known bot IP out there? Does checking known bot user-agents work?
View 5 Replies
Nov 1, 2010
[URL] How to select the RadioButton programatically?
View 1 Replies
Apr 21, 2010
Is it possible to change the SessionID Programatically without making the current Session Values to null.
View 3 Replies
Dec 16, 2010
I've been out of the programming since last winter and I'm really rusty.
What I'm trying to do is set a master page programmatically. I goggled it and found this:
Csharp Code:
[code].....
View 15 Replies
Feb 18, 2010
Just wondering if it is possible to programatically highlight all the text within a textbox.
Specifically, I have a text box with validation. If an error is thrown, I set the focus to the specified textbox, but the way it works now the user starts typing and none of the text that already exists disappears. I'm wondering if I can make it so that if the error is thrown, not only is the focus set to the textbox, but the text within the textbox is selected, so that if they simply start typing all of the old text disappears, or they can click and retype a single character if necessary.
View 6 Replies
Jan 25, 2011
I have on my page.aspx CheckBox with IDs representing the month.
Code:
<asp:CheckBox ID="January" runat="server" Text="Janvier" />
<asp:CheckBox ID="Febuary" runat="server" Text="Fevrier" />
<asp:CheckBox ID="March" runat="server" Text="Mars" />
<asp:CheckBox ID="October" runat="server" Text="Octobre" />
<asp:CheckBox ID="November" runat="server" Text="Novembre" />
<asp:CheckBox ID="December" runat="server" Text="Decembre" />
The ChecBox will be selected according to the user needs: 1, 2, 3 or more... When the page is fired, I wanted to get in the code behind the box which are checked so I can build a query consequently. So in the code behin, i have this:
[Code]....
View 9 Replies
Mar 26, 2010
I'm looking for a way to export a Word document as a PDF. I would like to do this without the use of a "software printer" (such as CutePDF, etc.) and stick to reference assemblies if at all possible. I'm using Microsoft Office Interop Assemblies to generate a Word Document which I save to a temporary directory. So its not necessary for this solution to interact directly with Microsoft Office, unless it needs to.
View 1 Replies
May 5, 2010
way to open a new tab on the current window? I'm thinking to have a control button on the webform and have this control button to open a web page on the new tab.
View 2 Replies
Jul 19, 2010
i have this code in my master page
[Code]....
what i want is, on the page load to change the value of the parameter so it changes the swf according to my conditions
but something like soce.value = ""
<object runat="server" id="banneria" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" width="600" height="120">
View 1 Replies
May 27, 2010
There is a website which shows history of lottery numbers. I want to retrieve numbers from the page, by using C# Windows or Web program(ASP.NET).There is a problem that, after selecting the week which you want numbers for from dropdownlist, page does not post. Numbers are retrieved by Ajax.
How can I get numbers for all of the weeks by program?
View 3 Replies
Dec 10, 2010
I like to build a components collection project so that I can use those components later on other projects. For example I created a UserControl called MyDataGrid.ascx
So suppose the projects layout are something like this:
--> IPGostarProject - Under namespace of IPGostar - contains components and lot's of user controls
--> SampleProject - here I want to use MyDataGrid.ascx UserControl from IPGostar namespace.
But as you know LoadControl function only takes virtual directory as it's parameter. So you can't load anything outside the SampleProject directory!
View 2 Replies
Nov 11, 2010
I am using GetMethods() method to get the list of all the available methods in WCF. But it returns everything, how can I only show the methods that I exposed to client.
[Code]....
How can I filter the methods only to WCF Servicecontracts?
View 3 Replies
Mar 31, 2011
am using c# with asp.net for wspproject. I am using spgridview to show the folders and files. When i clicked on folder, the spgridview bind with folder content(files/folders).Now i need to navigate folders based on the folder names like navigation bar in sharepoint.How to create the navigation bar for sharepoint folders?
View 1 Replies
Nov 29, 2010
I am dynamically generating a number of different types of files based upon a GridView in ASP.NET - an Excel spreadsheet and a HTML file. I am doing so using this code (this is just for the Excel spreadsheet):
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=InvoiceSummary" + Request.QueryString["id"] + ".xls");
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
contents.RenderControl(htmlWrite);
//GridView1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
I would like to give users the options of emailing the generated file as an attachment to either an email address they specify or one linked with their account on the database. But I don't want the user to have to save the file, then attach it in a form - I'd like to automatically attach the generated file. Is this possible, and how easy is it?
Of course, I'll be using the System.Net.Mail class to send mail...if it's possible anyway!
View 5 Replies
Aug 24, 2010
How do I get the value of the errorMode property set in the <system.webServer><httpErrors> element in web.config?
I'm trying to implement some "self-diagnostics" in an ASP.NET web application. When the app starts, it runs through some of the settings in web.config and confirm they're set correctly. While this code works quite nicely when the errormode is set in the <system.web><customErrors> element,
var errSec = (CustomErrorsSection)HttpContext.Current.GetSection("system.web/customErrors");
Response.Write(errSec.Mode.ToString());
it won't work once the site is deployed on IIS7 and this setting is now found in system.webServer -> httpErrors.
This won't work:
var errSec = (CustomErrorsSection)HttpContext.Current.GetSection("system.webServer/httpErrors");
And casting to a CustomErrorsSection also seems like a bad idea, there must be a better type to use?
I found this article on IIS.NET, HTTP Errors , but I hope to do this without the dependency on the Microsoft.Web.Administration library.
Okay, based on the suggestion below, I tried this:
var errSec = (ConfigurationSection)HttpContext.Current.GetSection("system.webServer/httpErrors");
Response.Write(errSec.SectionInformation.GetRawXml().ToString());
But that doesn't work either, the errSec object is null. And on a side-note, if I load the <system.web><customErrors> section using the same approach, the GetRawXml() method call fails with a "This operation does not apply at runtime." exception message.
I know how to load the whole web.config as an xml file and query that to get to the element I need. But it just seems to me like there must be a more elegant approach. How to read web.config as xml:
var conf = XDocument.Load(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "web.config");
var errMode = conf.Root.Element("system.webServer").Element("httpErrors").Attribute("errorMode").Value;
but that's just nasty! And if the errorMode setting is set in machine.config or similar, it won't work.
View 1 Replies
Apr 23, 2010
Do any of you know why this won't work?
<asp:BoundField HeaderText='<%=Lang.GetString("ManCan_Descripcion")%>' DataField="OcdObs" />
It's like the server is ignoring the <%%> tags, the page gets rendered like this:
<th scope="col"><%=Lang.GetString("ManCan_Descripcion")%></th>
View 2 Replies
Apr 29, 2010
I have stored image path in database. While displaying I have to get the image path from database and set it as the ImageUrl of Asp.NET Image control.But it is not displaying the image. below is the code of that.protected void Button1_Click(object sender, EventArgs e)
View 2 Replies
Aug 25, 2010
I am generating an email via codebehind in C# in my asp.net application using the line below:
ClientScript.RegisterStartupScript(this.GetType(), "FormLoading", "window.open('mailto:AccountsPayable@xyzCorp.com?subject=Invoice for ABC Corp - " + ddlJobCode.SelectedItem.Text + " - Supporting Documentation', 'email');", true);
Is it possible to include an attachment programatically as well (if the user points to the attachment document via a browse button) ?
View 2 Replies