|
Hello,
Does anyone have a code snippet for adding a blank row at the end or top of the gridview on a button click?The button is outside the GV and not in the footer.
I did it in datagrid and I guess it was easier.But for gridview it isn't working. I will post my little snippet but it is giving me error:
Protected Sub btnadddriver_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnadddriver.Click
DriverGV.DataBind()
Dim ds As DataSet = DriverGV.DataSource
Dim blank As System.Data.DataRow = ds.Tables(0).NewRow()
ds.Tables(0).Rows.InsertAt(blank, ds.Tables(0).Rows.Count)
DriverGV.EditIndex = ds.Tables(0).Rows.Count - 1
DriverGV.DataBind()
End Sub
The error I am getting is :
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object
Line 16: Dim blank As System.Data.DataRow = ds.Tables(0).NewRow()
If someone has a working snippet for adding a blank row to the gridview can you kindly help me?
I'm on Visual Studio2005,Asp.Net2.0,VB
Thanks.All help is much appreciated.
Aartee.
...HE is watching Us All!
|
|
|
|
|
|
Basically a have a link set in the appsettings section of the web.config file. I want to read the value from the aspx page if possible without even creating code behind function.
<<asp:hyperlink id="lnkSecureHome" style="FONT: bold 8pt Arial; COLOR: #067606; vertical-align: top; padding-right: 15px;" Runat="Server" NavigateUrl='<%=System.Configuration.ConfigurationManager.AppSettings("AppsHomePage").ToString %>' >Home<</asp:hyperlink> This fails as it literally points to 'http://localhost/...%3c%25=System.Configuration.ConfigurationManager.AppSettings...'.
However,
<<td>
<<%=System.Configuration.ConfigurationManager.AppSettings("AppsHomePage").ToString%>
<</td> works as expected displaying the value.
How do I set the property with in the html of an aspx page?
I know I can set the value in the form_load event but just curious how you do it from the html.
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
I haven't done any ASP.NET. However, what happens if you take the Runat="Server" attribute out? It seems to me that is the main difference between the two examples.
Regards
Andy
|
|
|
|
|
i created one webform in c# that contains login name and password if u r eligible person then the redirect form will be come.i hav a problem for this redirect page..i want to knoe the login time from the user.can u help me???
sureshkumaran
|
|
|
|
|
hi,
just try this:
after entering the user id & Pwd, just use this code to know the user login time.
DateTime LoginTime= new DateTime();
LoginTime=DateTime.Now;
private string lstrUserID; // To hold login user id
private string lstrPassword; // To hold login Password
this.lblErrorMessage.Text = "";
lstrUserID = txtUserID.Text.Trim();// Get the Correct User Login Id
lstrPassword = txtPassword.Text.Trim(); // Get the Correct User Password
< write the code for validating the User>
if the credentials are valid (valid user) then, to redirect the user
Response.Redirect("MainMenu.aspx");
}
else
{
lblErrorMessage.Text = "Invalid UserID / Password";(//to display the error message i am using label here, just use according to ur page)
}
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
What is your problem of redirect page?
suresh008 wrote: i want to knoe the login time from the user.can u help me
just get the system date...
<< >>
|
|
|
|
|
Hi,
Got a really annoying problem with downloading a file froma web site.
My code is pretty straight forward:
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + resource.Filename.Replace(" ","_"));
Response.AddHeader("Content-Length", resource.FileSizeBytes.ToString());
Response.ContentType = resource.MIMEType; // "application/octet-stream";
Response.WriteFile(fileToDownload);
//Response.Flush();
//Response.Close();
Response.End();
(You'll notice indications of desperation - randomly commenting code out) I have tried with the actual MIMEType and the application/octet-stream type - same result.
The download fails, and actually downloads the first x bytes of the web page itself, as the following Fiddler trace reveals:
Many thanks for any help you can give.
Nathan
--------------------------------------------------------------------
HTTP/1.1 200 OK
Date: Mon, 12 Feb 2007 19:47:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename=Blue-LogoOnly.gif
Content-Length: 5329
Cache-Control: private
Content-Type: application/octet-stream; charset=utf-8
<title>
Work Connexions | Your Files
|
|
|
|
|
This code works for me (in my button click event handler):
<br />
Response.Clear ();<br />
Response.ContentType = "application/octet-stream";<br />
Response.AddHeader ("Content-Disposition", "attachment; filename=\"foo.jpg\"");<br />
Response.WriteFile (Server.MapPath ("foo.jpg"));<br />
Response.End ();
|
|
|
|
|
I am trying to instantiate a class and am not able to do so (C# Visual Studio 2005).
In frm2, I wrote: private frm2 tmpfrm2; (This works in Visual Studion 2003 but not in 2005)
Help!
|
|
|
|
|
In Visual Studio 2005 if you go to Build menu you'll see an option for "Clean Solution". What exactly does this command do for us and also when should we use it?
Thanks.
Robert
|
|
|
|
|
It moves all the built libraries, executables, object files etc from the solution. Sometimes VS will get it's knickers in a twist with not updating the correct libraries etc and you can use Clean to force it to delete the old version and then next time it compiles you can (more or less) guarantee that the latest code / libraries will be used.
|
|
|
|
|
Hi Everyody,
I want to know what determines the maximum attachment size in an ASP2 web application.
I send an email from a web application & the attachment is about 2 MB.
Whenever I try to send it from the Visual Studio 2005 project,it takes much time then gives me an exception saying that it couldn't be sent & timed out.
It works normally in the VS 2003 application.
Any Clue??
Thnx a lot
|
|
|
|
|
Not sure if you are trying to attach the file from a web interface or if the file is located on the server.
If you are having the user upload the file as attachment then you might have to override the httpRuntime's maxRequestLength value in the web.config file.
By default ASP.NET only allows files with size 4MB [4096 KB] or less to be uploaded but you can change it like this:
<httpRuntime maxRequestLength="8192" />
|
|
|
|
|
Thanks a lot for your response..Actually the file is located on the server. Is there anything else I should change??
|
|
|
|
|
If file is located on the server then I would first check for common things like for instance if the file is locked or not, read access, other error handling code that might cause an infinite loop etc.
Post your code so we can see exactly how you are trying to attach the file. Thanks.
HTH
Robert
|
|
|
|
|
Thanks again Robert.
Actually I create a PDF file in the code,the file is placed on the server but after it is created,it's added automatically to source control..This doesn't happen in VS 2003 though I didn't change anything when converting the project to VS 2005 so I just want to remove a specific folder in the project from the source conttrol (Visual Source Safe) How can I do that??
|
|
|
|
|
You can do the following:
Goto File > Source Control > Exclude "MyFileOrFolderName" from Source Control
You can also exclude that folder from your VS2005 project if it is not directly used in the project that will also take care of the VSS problem.
Hope that helps
Robert
|
|
|
|
|
Thanks again Robert
|
|
|
|
|
You are welcome, hope your problem is fixed
|
|
|
|
|
I am attempting to create a web service that will send and received XML messages via SOAP. I am not certain which way to go on creating my client app. Ultimately , i have an application written in C++ that will have to ultimately receive the message, but is using C++ as a client much more difficult to code than using C#? Any advice or direction is appreciated.
Thanks,
|
|
|
|
|
If you know managed C++, it's not much different.
|
|
|
|
|
I was creating an web app using vs2005 in Vista when I encountered this problem.
The default setting of the password recovery control in the vs2005 only send password through smtp which doesn't require SLL. but what if that smtp,say, smtp.gmail.com, requires SSL?
Is there any solution besides hard coding the "Password Recovery Control" to enable SSL?
Is there any way to modify the code of the "password recovery control"
THanks~
|
|
|
|
|
some times this error was occured in our webserver. whem i made a direct request for a page then it goes to default error page . but again i refresh the page by using browser's refresh button it shows the page correctly. what is the reason behind this case. I thing it related to the server issues. Because other times my codings are running perfectly. if anybody is having same kind of problems then give me your ideas.
Thanks in advance.
|
|
|
|
|
You should catch and log the exception that is being thrown. This will give you a better idea of what is happening. Otherwise it's a bit hard to track down.
|
|
|
|