|
Problem/error message :
System.Web.HttpException: The GridView 'gv' fired event RowEditing which wasn't handled.
how i solve this problem while all things work properly like add, delete. but when i click on edit button its not work given error which i mention up.
I will do my best?
|
|
|
|
|
(in general this will happen when you want to add a code for any gui element)
in .net whenever you double click on any button, it will generate two entries, first it will register an event handler, and secondly it will create an empty function for you to code which will execute when that button clicked.
(your problem)
now here you have once created the function for that grid view and then after you have deleted that function, but the event registration is still there so when you run the code it will fire the event but there is no function code to execute. so just click on that gridview then go to properties and then click on a small tab for event. there will be an entry for that function just remove that and it will not show you the error.
Hope this will help...
|
|
|
|
|
i have a paragraph/article in database for example
abcdefghij aaaaaaa bbbbbbbbbb ccccccc dddddddd eeeeeee fffffff
i just want to show some beginning text from that paragraph/article in my asp.net page when user click details then it show the whole paragraph or article
HOW TO PICK STARTING TEXT FROM DATABASE ONLY abcdefghij NOT THE WHOLE ARTICLE?
|
|
|
|
|
First dont type in capitals it means you are shouting.
To cut of the text surely just set the character limit on the field when you take it from the database
|
|
|
|
|
you can use substring in your sql statement / C# code.
i.e.
SQL : select substring(para,1,10) from mytable where paraID = 1234
C# : short_para = para.Substring(0,10);
also just check the lenght > 10 of the string before this so that you will not get the error like. index is out of the string...or something...
and please (dont take this in wrong way) first try the google or msdn, if you dont get the answers then post in the forum. because there are soo many post in the different forums, for the indian developer posting basic questions (questions that can be found using google ot msdn). (I just read one in the Lounge)
may be this is the reason nobody is replying you, or i may also get a reply that dont answer such basic questions.
there is one article on code project for how use google search. please refer to that.
thanks...
|
|
|
|
|
I am reading some data from the database, but its giving System.InvalidOperationException:
my code is as follows :
LoadInfo l = new LoadInfo();
l.LoadFromSQL(Session["username"].ToString());
the class LoadInfo has the member function LoadFromSQL as follows,
public void LoadFromSQL(string username)
{
SqlDataReader reader = null;
reader = SqlMember.ExecuteReader("SELECT UserId FROM Members WHERE UserName=@username", username);
m.LoadFromReader(reader);
}
the SqlMember class has the static member function ExecuteReader as following:
static public SqlDataReader ExecuteReader(string qs,string username)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand(qs, conn);
cmd.Parameters.Add(new SqlParameter ("@username","a"));
conn.Open();
if (cmd.ExecuteScalar() == null)
{
int i;
i = 0;
}
return cmd.ExecuteReader();
}
the LoadFromReader member function of SqlMember class is as follows:
public void LoadFromReader(SqlDataReader reader)
{
this.UserId = (int)reader["UserId"];
this.FirstName = (string)reader["FirstName"];
this.LastName = (string)reader["LastName"];
this.CityId = (int)reader["CityId"];
this.CountryId = (int)reader["CountryId"];
this.Mood = (byte)reader["Mood"];
}
The exception is occurring in the above function, while reading the data from the reader
this.UserId = (int)reader["UserId"];
if this line is commented (//) the exception occurs in the next line.
Error:
Invalid attempt to read when no data is present.
The username provided by the session object is available in the database.
Please help me to solve this problem.
Is there any way to know, if the ExecuteReader returned any values ?
Apurv
|
|
|
|
|
I think it is showing you the error because you forgot to call Read()
also your query returns only UserID and you are reading whole row.
so change the
Select UserID FROM Members WHERE UserName=@username to
Select UserID,FirstName,LastName,CityId,CountryId,Mood FROM Members WHERE UserName=@username
in the LoadFromReader()
public void LoadFromReader(SqlDataReader reader)
{
if(reader.Read())
{
this.UserId = (int)reader["UserId"];
this.FirstName = (string)reader["FirstName"];
this.LastName = (string)reader["LastName"];
this.CityId = (int)reader["CityId"];
this.CountryId = (int)reader["CountryId"];
this.Mood = (byte)reader["Mood"];
}
else
}
also change the ExecuteScalar() to ExecuteReader()
because now you are getting more than one values.
|
|
|
|
|
thanx ....
will try with the changes ...
Apurv
|
|
|
|
|
Its working thanks .....
Apurv
|
|
|
|
|
Hi All,
I am developing a WebApplication using ASP.NET and C#.
there is a exception occurs when i call for a XmlWeb Service --Web Method.
This is the code.
try{
DataXML service=new DataXML();
service.Timeout = 10 * 60 * 1000;
object[] results = service.GetProductionData();
}catch(Exception ex)
{
str=ex.Message;
}
Here we have to wait around 100 seconds to get the response. But before that there is exception occurs and the error message says
'The underlying connection was closed: The connection was closed unexpectedly
So the client side returns a exception before results come. why is that??
can any one help on this?
Thanks in advance..
|
|
|
|
|
It is impossible to answer the way you have posted your question. Why don't you place a debugger in the method GetProductionData and see if there is a problem in that method or not.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
Hi,
I have debugged the code. but I can not find a error. while I am debugging the XML Webservice method,client side displaying the error message.
why is that? Is it like timeout error?
|
|
|
|
|
Post the code of your webservice method.
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
I use the ajax.net stuff a lot, but some of its features are not as nice as those found in Scriptaculous/Prototype. However, I have found that if you try and use a mixture of both on a site, it can cause bugs, so I had to ditch the Scriptaculous bits and just use ajax.net.
Has anyone used any other frameworks along side ajax.net without problems? Just wondering if there is a more compatible one out there?
Words fade as the meanings change, but somehow, it don't bother me.
|
|
|
|
|
Not specifically with ASP.NET Ajax, but I have had problems - mostly stemming from the fact that every man and his dog seems to have overridden the $ character - we did to do document.getElementById, but scriptaculous had also grabbed it...
C# has already designed away most of the tedium of C++.
|
|
|
|
|
aspnet_regiis.exe -ga "Network service"
The above command grants "Network service" access to the IIS metabase and other directoriesused by ASP.NET.
Is there any way to do using "Security Identifieir"SID[^] instead of user name, actually it is useful in Localized OS.
Thanks,
Mushq
|
|
|
|
|
Hi.
I have todevelope a web site that it uses ssl.
Providing ssl is with customer.
Do I do any special work in my programming?
or I do my traditional work (design & programming) and finally up it such previous?
Best wishes
|
|
|
|
|
Well, SSL has nothing to with programming, it is related with deployment.
But, if you are sending links somewhere in application than keep in mind to select the protocol using code rather than hardcoding(http or https)
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Manas Bhardwaj wrote: if you are sending links somewhere in application than keep in mind to select the protocol using code rather than hardcoding(http or https)
I didn't underestand it! can explain it, please?
Best wishes
|
|
|
|
|
Just make your site as normal. You don't need to do anything in programming for deploying with SSL.
The pages which you want to be on SSL should be properly called like https://yourdomain/yourpage.aspx
Ahsan Ullah
Senior Software Engineer
|
|
|
|
|
|
You don't need to add any extra code for a SSL site. You should get SSL from a provider, install on your server and request page using HTTPS protocol. It's the secure HTTP connection.
|
|
|
|
|
You should first have an SSL certificate installed on your domain.
Then do something like this depending on your requirements:
Write a redirect script, that redirects all requests to your website to https://
<br />
<%EnableSessionState=False<br />
host = Request.ServerVariables("HTTP_HOST")<br />
<br />
if host = "your-domain.com" or host = "www.your-domain.com" then<br />
response.redirect("https://www.your-domain.com/index.html")<br />
<br />
else<br />
response.redirect("https://www.your-domain.com/error.html")<br />
<br />
end if<br />
%><br />
This script needs to be named default.asp and placed in the folder your domain is pointing to.
|
|
|
|
|
Hey guys, whats happening ?
I'm using a ObjectDataSource and link it to a class which contains a method for selecting from database i try to configure the data source but I cannot choose a business object, the combo box in the wizard is empty !!! my class is in App_Code folder so automatically it must be loaded in the combo bod in the configuration wizard !
Thanx
Mr.K
|
|
|
|
|
Your question is not clear. Please always make it clear. What is your problem and what you want to do.
Ahsan Ullah
Senior Software Engineer
|
|
|
|