|
yes... great info friend...
Cheers.
|
|
|
|
|
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I got the following error when i try to browse my asp.net website from local IIS 5.1
Failed to access IIS metabase.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
I tried the support provided by MS iis help but it didn't help me.
plz give me any solution which can work
|
|
|
|
|
Did you registered ASP.NET Framework with IIS ?
Goto command Prompt> Goto Framework Directory >
Run aspnet_regiis -i
Then try to access your application.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
HI,
I created a html table with number of td and tr dynamically. I created as runat server
eg:
string html=
html += ";
Div.InnerHtmnl = html;
now i want to findcontrol of the table and set visible false in a button click event.
I use FindControl("tbl1").Visible= false, but it is not working.
Thankyou,
YPKI
|
|
|
|
|
yesu prakash wrote: string html=
You can't create a server control in this way. You may need to work with the Table[^] control class. Make sure you understand the viewstate issues before working with dynamic controls.
|
|
|
|
|
The problem is you cant write runat="server" as HTML. Actually when you write a basic html with runat=server, it actually creates an object of the control in the server and calls its RenderControl to get its output.
You can define your CustomControl as well to have the same situation.
So if you want to set the html dynamically, always write w3 standard html scripts.
|
|
|
|
|
Using UploadFile control to upload file to the server fails, if I upload twice the file with the same name with exception that path is not accessible coming from either UploadFile control or from File.Delete if I'm trying to remove it before uploading it again.
1) Clicking [browse] button, selecting the file, uploading it with say UploadFile.Save("path\file.txt"), and do some processing on the file.
2) Clicking [browse] button, selecting the same file, I try to upload the same file.txt to exactly the same location on the server UploadFile.Save("path\file.txt"). And the exception is returned.
I do not have such problems on my local computer.
Чесноков
|
|
|
|
|
Always add the exception message in your questions..
|
|
|
|
|
When uploading a file to server try to attach a GuId with the filename so that we can avoid file duplication problems.
|
|
|
|
|
Why don't you do a check to see if the file already exist? You need to work with File.Exist() method.
|
|
|
|
|
hi i have created stored procedure as follows:
ALTER PROCEDURE dbo.StoredProcedure1
(
@ID varchar(50),
@PassWord varchar(50),
@confirmPassword varchar(50),
@EmailID varchar(50)
)
AS
insert into Login(ID,Password,ConfirmPassword,EmailID)Values(@ID,@PassWord,@ConfirmPassWord,@EmailID)
RETURN
then i have used this storedprocedure in coding as.Actually m tryin to submit a form containing
id,password,conformpassword,email in table named Login:the code is:
public partial class emplogin : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Jajaipur"].ConnectionString);
SqlCommand cmd=new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlParameter ID = new SqlParameter();
SqlParameter Password = new SqlParameter();
SqlParameter Confirm = new SqlParameter();
SqlParameter Email = new SqlParameter();
cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value=txtid.Text;
cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value=txtpassword.Text;
cmd.Parameters.Add("@Confirm", SqlDbType.VarChar).Value=txtconfirmpassword.Text;
cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value=txtemailid.Text;
cmd = new SqlCommand("StoredProcedure1",conn);
cmd.CommandType = CommandType.StoredProcedure;
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
txtid.Text="";
txtpassword.Text="";
txtemailid.Text="";
txtconfirmpassword.Text="";
}
}
i got this error on rub time:Procedure or function 'StoredProcedure1' expects parameter '@ID', which was not supplied.
plz tell me wr m i wrong....
|
|
|
|
|
Ok.
Short version: move this line:
cmd = new SqlCommand("StoredProcedure1",conn);
to the top of your method.
Longer version: read up on collections.
[edit]sorry, wrong line[/edit]
mylogics wrote: i got this error on RUB time
I know it was a typo, but soooo funny
var question = (_2b || !(_2b));
|
|
|
|
|
i tried but givin same error...
|
|
|
|
|
Look man, it wont give an error, alright?
Please read my edited post.
You were adding to a collection of an object and then you constructed it again, therefore losing all previously assigned properties.
Move that line to before you're starting to add parameters and all will be well.
Believe me.
var question = (_2b || !(_2b));
|
|
|
|
|
thnks it worked...
|
|
|
|
|
change the code as blow....
protected void Button1_Click(object sender, EventArgs e) {
SqlCommand cmd = new SqlCommand("StoredProcedure1",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value=txtid.Text; cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value=txtpassword.Text;
cmd.Parameters.Add("@Confirm", SqlDbType.VarChar).Value=txtconfirmpassword.Text;
cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value=txtemailid.Text;
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
txtid.Text="";
txtpassword.Text="";
txtemailid.Text="";
txtconfirmpassword.Text="";
}
|
|
|
|
|
To update the page Friend.aspx partially by clicking on button deleteFriend of usercontrol Profile.ascx I use following code
Friend.aspx
<%@ Register Src="~/UserControls/ProfileDisplaySmall.ascx" TagPrefix="Kooras" TagName="ProfileDisplaySmall" %>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<Kooras:ProfileDisplaySmall ShowConnectionRequestButton="false" ShowDeleteButton="false" ID="pdProfileDisplay" runat="server" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
But nothing to do
I also add
<Triggers>
<asp:AsyncPostBackTrigger ControlID="deleteFriend" EventName="click"/>
</Triggers>
Profile.ascx
<asp:ImageButton ImageAlign="AbsMiddle" ID="deleteFriend" CssClass="cross" runat="server" OnClick="ibDelete_Click" ImageUrl="~/images/cross_icon_normal.png" />
Now compiler says deleteFriend does not exist in the current context(at Friend.aspx ).
What can I do? Plz ...
shahdat
|
|
|
|
|
I just suppose that u don't need to add triggers section
<Triggers>
<asp:AsyncPostBackTrigger ControlID="deleteFriend" EventName="click"/>
<Triggers>
it will remove the error of "DeleteFriend does not exist in the current context". Then just put a breakpoint on profile.ascx.cs file at function ibDelete_Click so that you can identify that there is no error in actual code.
and if you are displaying some message in some control or refreshing content of any control after delete then make sure that that particular control is the child of same UpdatePanel in which u have placed the Profile User Control's instance.
I hope it gonna help u.
|
|
|
|
|
Hi,
I have bought hosting and I put there all my web project,in folder App_Data I have database which I have created in SQLExpress.
Problem is that I cant connect in databse which is in host,in localhost works good without problem.
My connection string in webconfig file is
<br />
<add name="DBConn" connectionString="Server=www.mydomainname.com;Database=myDatabaseName;Trusted_Connection=True;"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings>
I get error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
How can I make connection string to access in database.
|
|
|
|
|
fattycode wrote: Server=www.mydomainname.com
This should be the url. Check with your hosting provider regarding the Server name/ipaddress.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
www.mydomainname.com I used only to explain problem,that is not my real domain name.
I tried too most of connection strings from www.connectionstrings.com but still is not working
|
|
|
|
|
i think u have to provide the access credentials to the database in the connection string.
|
|
|
|
|
Can you give me any example or any link to read about it?
|
|
|
|
|
try this sample connection string
Data Source=yourdataserver;Initial Catalog=databasename;Persist Security Info=True;User ID=DBusername;Password=DBpassword
just replace the values from the actual value.
|
|
|
|