|
|
hello i run into a little problem that i cant seem to understand.
I have a details view that i use to show, edit and insert data into a database, but when i try to insert a generated key into a text box in a template inside the details it says the object reference is not set to an instance of an object. But the weird thing is if i call the same method during the page load it works.... so why might this be???
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["id"] != null)
{
dataEmp = empleado.getEmployeeById(Request.QueryString["id"]);
DetailsView1.DataSource = this.dataEmp;
DetailsView1.DataBind();
}
else
{
dataEmp = empleado.getEmployeeById("noId");
DetailsView1.DefaultMode = DetailsViewMode.Insert;
DetailsView1.DataSource = this.dataEmp;
DetailsView1.DataBind();
btnNew_Click(sender, e);
}
}
}
protected void btnNew_Click(object sender, EventArgs e)
{
DetailsView1.ChangeMode(DetailsViewMode.Insert);
((TextBox)DetailsView1.Rows[0].FindControl("txtID")).Text = generateKey();
btnInsert.Visible = true;
btnNew.Visible = false;
Response.Write("clear form");
}
private string generateKey()
{
Random numb = new Random();
string generatedKey = ((char)((short) 'A' + numb.Next(26))).ToString() +
((char)((short) 'A' + numb.Next(26))).ToString() +
((char)((short) 'A' + numb.Next(26))).ToString() +
((char)((short) '1' + numb.Next(8))).ToString() +
((char)((short) '0' + numb.Next(9))).ToString() +
((char)((short) '0' + numb.Next(9))).ToString() +
((char)((short) '0' + numb.Next(9))).ToString() +
((char)((short) '0' + numb.Next(9))).ToString();
if (numb.Next(1, 2) == 1)
generatedKey += 'F';
else
generatedKey += 'M';
return generatedKey;
}
|
|
|
|
|
Hi Guys,
in slideshowextender we can show our image ...,
similarly i want to show my database records in slideshow (left to right)...,
how to do that?, for example i need like in "www.in.com"
the left side some images and its contnets will go on...,
like that want to create...,
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Did you searched it in google before post it over here. In code project, there is an excelent article on the same,
Slide-Show User Control
|
|
|
|
|
In my application i want to read data from a (.dat) file line wise.can anyone give me a clue, how to achieve it.
Thanks in advance.
|
|
|
|
|
Search in article section of code project. You will find many articles.
|
|
|
|
|
souravghosh18 wrote: In my application i want to read data from a (.dat) file line wise.
By .dat file, i beleive you want to mean the text file with .dat extentaion
souravghosh18 wrote: can anyone give me a clue, how to achieve it.
Try Following :
static void Main(string[] args)
{
StreamReader StrReader;
string Str;
StrReader = File.OpenText("e:\\sample.dat");
Str = StrReader.ReadLine();
while (Str != null)
{
Console.WriteLine(S);
Str = StrReader.ReadLine();
}
StrReader.Close();
}
Now, This is nothing to related with ASP.NET. So from the next time post question in proper forum
|
|
|
|
|
Hi to all,
I am stucked in a problem. I am using reorderlist control for reordering. It is working fine. But when I published and uploaded the site on server, it is not working. I am unable to find the reason.
Can anybody please help me on this.
cheers,
sneha
|
|
|
|
|
Make sure System.Web.Extensions added in Web.Config file. Otherwise it should be work. If you are getting any exception then let me know
|
|
|
|
|
Hi Parwej,
You mean to say in the section group name? Yes it is there
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
cheers,
sneha
|
|
|
|
|
Probolem is seems to be WebEXtensions dll install in GAC your local machine. But not able to find on your remote machine (Hosted machine) so this is the actual issues.
Please go with post
http://forums.asp.net/t/1055356.aspx[^]
If you are still facing the problem then let me know.
|
|
|
|
|
Thanks for replying. I am just checking with the hosting wether they have ajax installed or not.
cheers,
sneha
|
|
|
|
|
sneha Choudhary wrote: it is not working
Sneha,
you should mention, what does it mean by "Not Working". To get the proper answer it will be better if you provide the proper error description.
Thank you !
|
|
|
|
|
Hi Abhijit,
Sorry for giving the incomplete information. Actually I am using the reorderlist control to give the functionality so that admin can re-order the links in the main site. It was working fine at my development pc but when I uploaded it on the server it is not working ie the functionality to drag and drop the links for reordering is not working ie I am unable to drag the links.
In my last conversation I came to know that may be there is some problem at the server end. Now I am suspecting one thing.
I am using asp.net version 3.5 and ajax control toolkit version 3.5.20229. On the server we have .net framework 2.0. So I doubt may be it is the reason. So I downloaded the older version of the ajax toolkit and placed it in the bin folder and again published and uploaded. But of no use.
So can it be the reason that I am using asp.net 3.5 and ajax control toolkit version 3.5.20229 and on the server I have asp.net 2.0.
Please assist me...
cheers,
sneha
|
|
|
|
|
i have to create user-defined control search button . The button must have a back background with white font !
How to create it !
|
|
|
|
|
chienbq0709i wrote: i have to create user-defined control search button . The button must have a back background with white font !
Is this your home assignment ??
|
|
|
|
|
I found 46,000,000 examples here[^]
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.
|
|
|
|
|
you forgot to mention the time
Results 1 - 10 of about 46,000,000 for asp.net user control. (0.18 seconds)
|
|
|
|
|
Hi All,
I have Dataset having 10 table data. I want to Insert these data into respective tables in SQL Server.i tried with google but didnt get anything useful. so Please suggest me for the same.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Ash_VCPP wrote: so Please suggest me for the same.
First you tell me how this is related to ASP.Net?
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.
|
|
|
|
|
thanx man for your support, i would like to appiciate this answer.....now can you please tell me where i should have posted it?????
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Ash_VCPP wrote: I have Dataset having 10 table data. I want to Insert these data into respective tables in SQL Server.i
Good !
Ash_VCPP wrote: i tried with google but didnt get anything useful
See, I did THIS and check the result.
|
|
|
|
|
oh great work...i can not even think of doing this.my friend if it was that much easy then i had not posted it on forum......my concern is that i have to insert data in multiple tables from a dataset which contains data for multple tables.this time i am expecting specific answer not any funny demo....so please if you can then provide me a solution.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
hiii.....
i have a form named sale form.on each n every sale of a product i wanna to update the quantity n totalprice columns of the table named purchaseproduct.can u giv me the code.
wat shud i do.shud i use datareader.i hav tried a bit but dont
know wat to do further.this is the code...
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(GetConnectionString);
string sql = "Select * From PurchaseProduct";
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
}
}
}
thanks......
|
|
|
|
|
What do you want .Here in the above code,You are reading the values from PurchaseProduct table.
Do you want to update the the table columns?
If yes you can not Like this.Datareader is used just for reading the data.
For updating,
read this one
|
|
|
|