|
Hi,
I have checked out the complete code, but i require the code in C#.
|
|
|
|
|
Hi,
I want to display data into gridview.I wrote the following code;
string str="Data Source=KALSYSTE-X6VVC3\\SQLEXPRESS;Trusted_Connection=yes;Initial Catalog=Northwind";
SqlConnection con = new SqlConnection(str);
SqlDataAdapter da = new SqlDataAdapter("select * from employees",con);
DataSet ds = new DataSet();
da.Fill(ds, "employees");
GridView1.DataSource = ds;
GridView1.DataBind();
When i run the application,it is giving the following exception:
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.
Please help me.
Thanks in advance
|
|
|
|
|
The error message is clear enough and also gives you the solution. You basically use either the DataSource or DataSourceID to bind data to the GridView control.
|
|
|
|
|
Did you initialize DataSourceID for your GridView? If yes, comment or delete that line and run your app.
|
|
|
|
|
Hello.
I'm writting a web service which is constructed of some DLLs.
Each dll has its configuration properties.
I would like to be able to save & read these configuration paramaters in files (a file for each DLL) during runtime. I found endless classes from Framework 2.0 that claim to do this but haven't found nothing that saves the configuration to a simple file and reads it back in a simple manner.
In the Configuration namespace I found a way to save paramaters. I constructed a ConfigurationSection and was able to save it into a file but found no way to read it (very strange to find a SaveAs mathod without a Read method). Just saving it would create a XXX.exe.config which isn't going to work for the webservice.
Any ideas ?
Gilad.
|
|
|
|
|
Hi there,
Here are a couple of tips which are already documented in MSDN:
+ You can use the methods of the ConfigurationManager or WebConfigurationManager to open the config file, and these methods basically return the Configuration object.
+ The Configuration object provides you with the GetSection, GetSectionGroup to read the configuration settings, and the Save, SaveAs methods to save the settings.
|
|
|
|
|
Hi,
I am facing a problem in my web application while i am trying to print an html page, whose url is specified in a textbox, using axWebBrowser component. I am getting an error "Exception of type InvalidActiveXStateException was thrown", at axW.Navigate statement. Please help me to rectify this problem.
private void Button1_Click(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
object empty= null;<br />
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(WebForm1));<br />
AxWebBrowser axW=new AxWebBrowser();<br />
axW.Enabled=true;<br />
axW.Visible=false;<br />
axW.OcxState = (System.Windows.Forms.AxHost.State)(resources.GetObject("axW.OcxState"));<br />
axW.Navigate(TextBox1.Text,ref empty,ref empty,ref empty,ref empty);<br />
axW.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER ,ref empty,ref empty);<br />
}<br />
catch(Exception Ex)<br />
{<br />
Response.Write(Ex.Message.ToString());<br />
} <br />
}
Thanks,
Sai.
|
|
|
|
|
Don't cross post your question and you may get answer
|
|
|
|
|
Hi. Is it possible to set the SMTP settings for the PasswordRecovery control from code rather than having it in the web.config file (in the System.Net -> mailSettings element)?
I use the same code for several different applications and I want the e-mails to come from the various application e-mail address rather than just one hard-coded in the web.config file.
I would like to set the SMTP server, username, password, etc. in the Page_Load() event, for example.
None of the docs or Google hits I found addressed this for the PasswordRecovery control. I found examples of sending generic e-mails, but none address the PasswordRecovery control.
Thanks!
Barry Etter
|
|
|
|
|
I think I see what you mean. You can set a bunch of subproperties of the MailDefinition object in code from Page_Load(), but you can't specify the server. And MailDefinition is read-only, so you can't create a different one.
You could always handle emailing the password manually, and construct a MailMessage yourself instead of using the PasswordRecovery's built-in email capability, using an SmtpClient object to send it.
|
|
|
|
|
Has anyone used the aspexec dll? If so, where can it be downloaded?
What I'm trying to do is determine the person signing into my webpage is accessing the webpage from their computer. Does anyone know code or software I can use for this, other than aspexec dll?
Thank You.
zxcvbnm
|
|
|
|
|
Hello,
I made two asp.net pages with VB.Net code, the first page is to post a message to the acceess data base, and the second page contains a repeater wich shows all the messages in the access database, but the repeater shows the posted messages without any line breaks. (line1. line2)
so what is the solution??
Note: I'm using VB codes
Thanx
|
|
|
|
|
What's your sql?
What does your repeater look like?
|
|
|
|
|
it's a microsoft access 2003 database.
and here is my repeater's code:
<asp:repeater id="rptGuestbook" runat="Server">
<headertemplate>
<itemtemplate>
<separatortemplate>
<footertemplate>
<%# Container.DataItem ("Name") %> | E-mail: | <%# Container.DataItem ("EMail") %>
| Website:
|
<asp:hyperlink id="HyperLink" runat="server" font-names="Tahoma" font-size="X-Small" navigateurl="<%#" container.dataitem="" ("url")="" %="">>
<%# Container.DataItem ("URL") %>
| Comment:
| <%# Container.DataItem ("Comment") %>
| |
|
|
|
|
|
When you display the text, html-encode the text, then replace the line breaks (Environment.NewLine) with "<br>" (or "<br />").
---
b { font-weight: normal; }
|
|
|
|
|
Hi all
I have created usercontrol templates and stored the template code in database. The templates are for instance postcards, visiting cards etc..
I want to load these usercontrol templates dynamically to my web page. I referred to http://aspalliance.com site where the author has mentioned about use of usercontrol templates...
I want to know how I can load the the usercontrol using the template code from database on the web page...
please help me...
thanks in advance...
|
|
|
|
|
Hi there. A UserControl, as a subclass of TemplateControl can use the LoadControl() method to load a usercontrol given a virtual file path. Unfortunately, there isn't an override that allows you to load a usercontrol given a string (which could be fed by your database source).
However... in ASP.NET 2.0 we now have the
VirtualPathProvider[^] class. It seems to me you may be able to build your own VirtualPathProvider to intercept requests for ".ascx" files and instead get that data from the database.
That sounds like a pretty good concept for a CP article...
|
|
|
|
|
|
Hi all,
how to calculate number of days between two days e.g
from date 01/07/2006 To date is 10/07/2006.. i want to calcilate no.of days.
Help me urgent. in asp.net
|
|
|
|
|
DateTime aDate;
DateTime anotherDate;
Timespan diff;
diff = aDate.Subtract(anotherDate);
Timespan has properties like days, years etc.
|
|
|
|
|
its working properly...
thanks for ur answer...
|
|
|
|
|
Hello. I am having some trouble sharing a web application with Visual SourceSafe. Here is what I've done:
-I have created a web application with VisualStudio2005 and saved it to the folder 'C:\Projects\WebSite' in my workstation.
-Then I added it to SourceSafe 6.0 (to '$\Projects\WebSite') with the 'add solution to source control' option in VisualStudio2005.
-A developer in other workstation entered SourceSafe and clicked get latest version in '$\Projects\WebSite'. The web application was copied locally to 'C:\Projects\WebSite'.
-Then he double clicked the solution file to open the project. VisualStudio returned an error message saying that the folder 'WebSite' does not existed, and then it automatically created an empty new 'WebSite' folder beneath 'C:\Projects\WebSite'.
I don't understand why it searches for 'C:\Projects\WebSite\WebSite' instead of 'C:\Projects\WebSite'.
I also noticed that, when opening the solution file with notepad, there is a reference to the absolute path of the solution as in the workstation where it was originally created before being added to source safe.
What am I doing wrong? Any help?
Thank you very much.
|
|
|
|
|
DOn't add the solution file (sln) to VSS, you should only add the project file (csproj or vbproj).
|
|
|
|
|
In Visual Studio 2005 there is no project file for web applications, just solution file, so the problem must be other thing.
But thanks for the advice anyway.
|
|
|
|
|
If you have more than one project in the solution it does add the sln file to VSS when you use the "Add Solution to Source Control"
|
|
|
|