|
U cannot fill the dataset with null value of dataadapter.
the problem is with retrieving top value.
mySqlDataAdapter = New SqlDataAdapter("Select top 1 * from tblsalarydetails where empid='" & _
eid & "' and (datepart(yyyy,edate) < '" & Val(ddlYears.SelectedItem.Value) & "' or (datepart(yyyy,edate) = '" & _
Val(ddlYears.SelectedItem.Value) & "' and datepart(mm,edate) <= '" & Val(ddlMonth.SelectedItem.Value) & "')) order by edate desc", sqlconn)
mySqlDataAdapter canot be null
Sarith...
|
|
|
|
|
Hi i have checked that query...,
It's contained value...,
But i am getting that error...,
Thast y i given my full code on there...,
Regards,
Magi
|
|
|
|
|
Hi all,
Can we change the position of controls in clientside.
consider in an example.
In panel1 their is textbox firstname
panel2 their is textbox lastname next to this thier is a button btnup
if user clicks button btnup then
The panel2 i.e textbox lastname has to move to position of panel1(top) and panel1 has to come below panel2..
lastname has to come first and firstname has to come below..
thanks in advance
santosh
|
|
|
|
|
This can be done by AJAX more suitably
but if you want to do with javascript you can do
you want to do at client side :-
Then add one more panel with textbox ,...
hide first panel and show third one after button click
Thanks and Regards
Sandeep
If 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... "
|
|
|
|
|
How can i include files when i have a master page?
Here is the logic:
Page 1 -------------> Page Check ------------> Page 2
Now, before the user can go to Page 2 it must be check first if the user has the rights to the page...
I have a master page which confuses me. Anyone knows how to tackle this?
|
|
|
|
|
Your page will be in the Master page content place holder
put your all validatiion in the page 1 event (When you want to check )
master page should contain only the common things that you want to show in your application such as header footer Menu etc
Google Master page that will more helpfull for you
Thanks and Regards
Sandeep
If 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... "
|
|
|
|
|
Hi All,
I am programmatically creating a datagrid bound columns (in ASP.NET 2.0). During initial page load there is no problem but after the postback i am getting following error.
Error Start --------------
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Error End --------------
I know that in order to avoid event validation we can set the following parameters in the config file.
enableEventValidation="false" validateRequest="false"
but since there can be a risk of a hole in the security i do not want to go with that.
Hence i am using the following code to register my event during page render stage.
protected override void Render(System.Web.UI.HtmlTextWriter e)
{
foreach (Control control in this.Controls)
{
Page.ClientScript.RegisterForEventValidation (control.UniqueID);
}
foreach (DataGridItem grdRow in grdvwCheckbox.Items)
{
Page.ClientScript.RegisterForEventValidation(grdRow.Cells[0].UniqueID);
}
base.Render(e);
}
Since i am getting following error in the trace.
Error Start--------------
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2080220
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +32
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Error End -------------
I suppose that there is a problem with the item command buttons in the datagrid (Cell[0]). Hence i am registering those buttons also but still i am getting the error message.
I also have 2 hidden fields but since i am registering all the controls guess that should not create any problem.
Please let me know where am i going wrong.
Regards,
Anees
|
|
|
|
|
am having the problem when retreving data from database.
i hav a value in database "page'3.aspx". single quotes is there.
i retrieve it and displays it in a datagrid as a link.The link displays like page'3.asp but the problem is with link doesnt have that single quotes. that is when i click that link it goes to page3.appx
How can i solve this problem.please help me
Sarith
-- modified at 3:24 Thursday 9th August, 2007
|
|
|
|
|
whats the purpose of putting a single quote? (page'3.aspx) and storing it on your database? i mean why would you something like that?
|
|
|
|
|
sarithka wrote: The link displays like page'3.asp
It's not displaying like page'3.aspx ?
sarithka wrote: page3.appx
APPX ? Explain your problem clearly.
|
|
|
|
|
yea its displaying like this "page'3.aspx" but the problem is actually the link holds only page3.aspx.. u got my prblem??
means its displaying like this page'3.aspx but when i click to that link it redirect to page3.aspx
sarith
|
|
|
|
|
sarith.ka wrote: means its displaying like this page'3.aspx but when i click to that link it redirect to page3.aspx
Goto viewsource and check what is the link. You can check in the status bar also when mouse points over the link. Check there it is coming like page'3.aspx
|
|
|
|
|
no its comning like page3.aspx.
the same thing i bind with gridview there it comes like page'3.aspx
what will i do pls help me
thanks for ur response
Sarith...
|
|
|
|
|
Hello All,
How to upload my local text file to remote server
using ftp command.
i got some code, so when i try to
implement that code in my application i am getting error.
Below i gave what code i implement...
****************************************************************
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using System.Timers;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Net.FtpWebRequest clsRequest = (System.Net.FtpWebRequest)System.Net.WebRequest.Create("E:\\xxxx\\xxxx\\xx\\xxx\\Upload\\downloadnav.txt"); //Here serverpath where we have to upload.
clsRequest.Credentials = new System.Net.NetworkCredential("xxxxxx", "xxxxxxxx"); ///username and password
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile;
byte[] bFile = System.IO.File.ReadAllBytes("F:\\xxxxxxx.txt");
System.IO.Stream clsStream = clsRequest.GetRequestStream();
clsStream.Write(bFile, 0, bFile.Length);
clsStream.Close();
clsStream.Dispose();
}
}
**********************************
I am getting the following error ...
*** Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.FtpWebRequest'.
So kindly suggest me is there a different way to create the request object to accomplish what I need .
Thanks
Vijay
|
|
|
|
|
MSDN have a solution for using asynchronous operations to upload a file to an FTP server http://msdn2.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^]
It states that you need a Uri argument attached to your declaration/instantiation for FtpWebRequest object.
<br />
public class AsynchronousFtpUpLoader<br />
{ <br />
public static void Main(string[] args)<br />
{<br />
ManualResetEvent waitObject;<br />
<br />
Uri target = new Uri (args[0]);<br />
string fileName = args[1];<br />
FtpState state = new FtpState();<br />
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(target); << This is the important bit.<br />
request.Method = WebRequestMethods.Ftp.UploadFile;<br />
Hope this helps
=======================================
There are 10 type of people in the world....
those who understand Binary, and those who don't!
=======================================
-- modified at 4:40 Thursday 9th August, 2007
|
|
|
|
|
You can try this way..
public void uploadFileFTP(string CompleteFTPPath, string CompleteLocalPath)
{
FtpWebRequest reqObj = (FtpWebRequest)WebRequest.Create(CompleteFTPPath);
reqObj.Credentials = new NetworkCredential("username", "password");
reqObj.Method = WebRequestMethods.Ftp.UploadFile;
byte []testFile = File.ReadAllBytes(filepath);//d:abc.txt
//upload
Stream streamObj= reqObj.GetRequestStream();
streamObj.Write(testFile,0,testFile.Length);
streamObj.Close();
streamObj.Dispose();
}
SHWETA!!
|
|
|
|
|
Thank you KernowMan and Shweta
Thank you for providing the code snippet.
My code worked fine after changing K:\\xxxx to ftp://xx.com.
Regards,
Vijay
|
|
|
|
|
Hi,
My project is stuck because of a simple issue if possible please help me out and an early reply will be really helpful.
I want to store a Value in the page itself and use it in the page initialization (Page_Init).
This particular value is page specific, it is not fixed and it can vary from user to user.
In my project I use the value after the postback in the initialisation stage.
My requirement is such that i do not want to use session or cookie. I cannot use viewstate since it is available only on Page_Load. Also since it is a variable value i cannot use database.
Please let me know if it is possible, if yes then how.
Please feel free to revert in case of any clarification.
Thanks!
|
|
|
|
|
Are you allowed Hidden variables?
|
|
|
|
|
Yes, i am using a hidden field for storing the value but after the postback that value will not be available to me during page initialisation.
Thanks!
|
|
|
|
|
Anees Mitha wrote: but after the postback that value will not be available to me during page initialisation.
Can't you access this variable some where other than init event ? Have you tried Request.Form[""] ?
|
|
|
|
|
It is not a form submit event, it is a postback event. The value i need is after the postback in the page initialisation stage.
Thanks!
|
|
|
|
|
Anyone please reply, i am really confused as to how to move ahead with this problem.
Thanks!
|
|
|
|
|
Hi everybody
This Sree
I have login page in my web App and Login Control in it.
Here i want to prefill the login control with username and password in next login if that user once has logged in by checking 'Remeber Me Next Time' check box.
i wanna avoid bypassing user to the authorised pages instead of prompting login credentials .
thank u all
sree
cnu
|
|
|
|
|
Hi friends
i need the code in datagrid paging
Page: 1 of 7
like this
regards
saravanan
|
|
|
|