|
I would guess this has something to do with them running in different sessions, but it seems odd to me, I don't see how a server side construct can effect client side only behaviour.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Seemed very odd to me too!! I'm thinking I have client side Javascript trying to talk with client side Javascript... And what the .aspx is trying to talk with is the frameset that loaded it! Obviously, we're both missing something somewhere! Hope this makes sense to someone.
sr
|
|
|
|
|
Hi,
In my web site I have to put one button with the name "Continue to work". The website is having multiple pages. Users will work in that website, close the web page. Next when they login into the web site they click on " Continue To Work" button. So this button will take them to the page where they stopped prevously. How to implement this behaviour?
Thanks in advance.
|
|
|
|
|
You need to maintain previous state into database accordingly your required fields.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Hi everybody
I have a sql2000 database and I want to save picture in it.If I save the names of the pictures in database and save pictures in a file , how can I use these pictures in a datacontrol (grideview ,detailview ,...) I use asp.net2.0 with C#.I don't know what code should I write.pleas help me .thanks
|
|
|
|
|
bbc_sh wrote: If I save the names of the pictures in database and save pictures in a file , how can I use these pictures in a datacontrol (grideview ,detailview ,...)
If you get the file path from database, using it is trivial. Just put a HTML image tag and assign this URL as "src". If it is inside a GridView/DataGrid, put a template column and add image tag inside this.
|
|
|
|
|
can you give me a good resource.
|
|
|
|
|
PLS TRY THIS
IN HTML
<form id="form1" runat="server">
<div>
<div>
<div>
Image Title:<asp:TextBox ID="txtImgTitle" runat="server"></asp:TextBox>
</div>
<div>
Browse Image:<asp:FileUpload ID="fileImgUpload" runat="server" />
</div>
<div>
<asp:Button ID="btnUpload" runat="server" Text="Save" OnClick="btnUpload_Click" /></div>
</div>
<br />
<br />
<div>
<asp:GridView ID="GridView1" runat="server" CellPadding="5"
GridLines="None" ShowHeader="False" Width="394px" AllowPaging="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="imgSaved" runat="server" ImageUrl='<%# imageURL(DataBinder.Eval(Container.DataItem, "img_id").ToString()) %>'
AlternateText='<%#DataBinder.Eval(Container.DataItem,"img_title") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</form>
CODE
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
displayImages();
}
}
protected void btnUpload_Click(object sender, EventArgs e)
{
int imageSize;
string imageType;
Stream imageStream;
// Gets the Size of the Image
imageSize = fileImgUpload.PostedFile.ContentLength;
// Gets the Image Type
imageType = fileImgUpload.PostedFile.ContentType;
// Reads the Image stream
imageStream = fileImgUpload.PostedFile.InputStream;
byte[] imageContent = new byte[imageSize];
int intStatus;
intStatus = imageStream.Read(imageContent, 0, imageSize);
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("insert into tbl_image(img_title,img_stream,img_type) values(@img_title,@img_stream,@img_type)", myConnection);
// Mark the Command as a Text
myCommand.CommandType = CommandType.Text;
// Add Parameters to Command
SqlParameter img_title = new SqlParameter("@img_title",SqlDbType.VarChar);
img_title.Value = txtImgTitle.Text;
myCommand.Parameters.Add(img_title);
SqlParameter img_stream = new SqlParameter("@img_stream", SqlDbType.Image);
img_stream.Value = imageContent;
myCommand.Parameters.Add(img_stream);
SqlParameter img_Type = new SqlParameter("@img_type", SqlDbType.VarChar);
img_Type.Value = imageType;
myCommand.Parameters.Add(img_Type);
try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
Response.Redirect("upload.aspx");
}
catch (SqlException SQLexc)
{
Response.Write("Insert Failure. Error Details : " + SQLexc.ToString());
}
}
public void displayImages()
{
try
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
myConnection.Open();
SqlCommand myCommand = new SqlCommand("select * from tbl_image", myConnection);
// Mark the Command as a Text
myCommand.CommandType = CommandType.Text;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet myDataSet = new DataSet();
myAdapter.Fill(myDataSet);
GridView1.DataSource = myDataSet;
GridView1.DataBind();
myConnection.Close();
}
catch (SqlException SQLexc)
{
Response.Write("Data Retrival Failure. Error Details : " + SQLexc.ToString());
}
}
public string imageURL(string img_id)
{
return ("retrieveImages.aspx?id=" + img_id);
}
|
|
|
|
|
Hi, i have formview control in my page and on that i have two textboxes and button in it which display at runtime. i declare the button event in my aspx.vb
Protected Sub insertbutton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsValid Then Exit Sub
' Determine the currently logged on user's UserId
Dim currentUser As MembershipUser = Membership.GetUser()
Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)
Dim connectionString As String = ConfigurationManager.ConnectionStrings("SecurityTutorialsConnectionString").ConnectionString
Dim insertSql As String = "INSERT INTO Reply(Subjects, Bodi, CommentDates UserId) VALUES(@Gameid, @Subjects, @Bodi, @CommentDates, @UserId)"
Using myConnection As New SqlConnection(connectionString)
myConnection.Open()
Dim myCommand As New SqlCommand(insertSql, myConnection)
myCommand.Parameters.AddWithValue("@Subject", subject1.Text.Trim())
myCommand.Parameters.AddWithValue("@message", message.Text.Trim())
myCommand.Parameters.AddWithValue("@CommentDates", DateTime.Now())
myCommand.Parameters.AddWithValue("@UserId", currentUserId)
myCommand.ExecuteNonQuery()
Label2.Text = "Your Comment has Been Added to our Database. Thank You"
myConnection.Close()
End Using
End Sub
and the button property
<asp:button id="Button1" runat="server" text="post" causesvalidation="true" onclick="insertbutton_Click" xmlns:asp="#unknown">
but when i click on button it shows the error like this.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30451: Name 'subject1' is not declared.
Source Error:
Line 39:
Line 40: Dim myCommand As New SqlCommand(insertSql, myConnection)
Line 41: myCommand.Parameters.AddWithValue("@Subject", subject1.Text.Trim())
Line 42: myCommand.Parameters.AddWithValue("@message", message.Text.Trim())
Line 43: myCommand.Parameters.AddWithValue("@CommentDates", DateTime.Now())
i place the following in my onload event
Dim drp As Label
drp = form1.FindControl("Label2")
Dim erp As TextBox
erp = form1.FindControl("subject1")
Dim crp As TextBox
crp = form1.FindControl("message")
but the object not handled at runtime.
Please help me to solve this.
Thank you
saquib
|
|
|
|
|
I Guess
Dim myCommand As New SqlCommand(insertSql, myConnection)
myCommand.Parameters.AddWithValue("@Subject", erp.Text.Trim())
myCommand.Parameters.AddWithValue("@message", crp.Text.Trim())
myCommand.Parameters.AddWithValue("@CommentDates", DateTime.Now())
|
|
|
|
|
Hi, i have sql membership provider in my database and i want to join two different tables in sqldatasource i.e. i have this select statement in my aspx page.
<asp:sqldatasource id="Games" runat="server" xmlns:asp="#unknown">
ConnectionString="<%$ ConnectionStrings:SecurityTutorialsConnectionString %>" SelectCommand="SELECT dbo.aspnet_Users.UserName, GameComment.Subject, GameComment.Body, GameComment.CommentDate, saquib.Reply.Subject, saquib.Reply.message From GameComment INNER JOIN dbo.aspnet_Users ON GameComment.UserId = dbo.aspnet_Users.UserId AND saquib.Reply.UserID = dbo.aspnet_Users.UserId ORDER BY GameComment.CommentDate DESC" />
their is three tables asp.net_users, GameComment and reply, should understand what i say on my above code.
and other query is that, i want to put the statement like that
<asp:sqldatasource id="Games" runat="server" connectionstring="<%$ ConnectionStrings:NorthwindConnectionString %>">
SelectCommand=SELECT dbo.aspnet_Users.UserName, GameComment.Subject, GameComment.Body, GameComment.CommentDate, saquib.Reply.Subject, saquib.Reply.message From GameComment INNER JOIN dbo.aspnet_Users ON GameComment.UserId = dbo.aspnet_Users.UserId AND saquib.Reply.UserID = dbo.aspnet_Users.UserId ORDER BY GameComment.CommentDate DESC" >
Please help me to solve this.
if you wish, i can show my database structure and relationship to you.
Thank you
saquib
|
|
|
|
|
To solve what? What is the problem?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
how to use the OpenFileDialog in web application using c#?
i've heared it's by using Activex but i didn't know how to do it in anyways
|
|
|
|
|
The easiest way to deal with files is using the Input tag with Type=File. Then you can upload the file to the server and deal with it there. If you want to show the user files on the server, you will have to write a custom control to do it, but I wouldn't recommend it anyway. What are you trying to do?
|
|
|
|
|
what i'm trying to do is that allowing the user to upload a file from his own computer.
anyways the 'input' inst. i couldn't use it 4 a Button Click Event Handler.
|
|
|
|
|
That's right, the Browse button on the file input won't post back to the server; you'll have to add a second button to do that. Then you'll have the file in the PostedFile property of the input.
|
|
|
|
|
how to call a javascript function from javascript file in asp.net 2.0
i added a java script file
and written two functions
now how to call these two functions
how can i get reference to that file
plz help me
thanks in advance
vijay
|
|
|
|
|
vijaylumar wrote: how to call a javascript function from javascript file in asp.net 2.0
Include the JS file to the page(head section) and call as usual.
|
|
|
|
|
plz help me!!!!!! I'm making an online examination and counselling project for my training. but I'm stuck at using timer in the examination. somebody plz help fast.
|
|
|
|
|
Panks_macho wrote: somebody plz help fast.
You are getting first reply after 6 hours ! If you mind to read the forum posting guidelines before posting, you could have formatted a better question and might have got many replies. Asking for urgent help is considered as rude here.
Panks_macho wrote: but I'm stuck at using timer in the examination
This is not explaining anything. What are you using ? Are you using "setTimeout" JS method or "Timer" control in the "AJAX Toolkit" ? What is the error you are getting ?
|
|
|
|
|
i have create run time pdf file . how to read this file and give the print without opening pdf file.
Thank & Regards
Lav
lav naphade
|
|
|
|
|
Accessdatasource control
1> i m using insertcommand with simple query to insert data in access but nothing is happening.
2> how i can use parameter query to for insertcommand.
thanks in advance.
|
|
|
|
|
dream_liner_7e7 wrote: i m using insertcommand with simple query to insert data in access but nothing is happening.
Please stop posting same question. Follow the previous thread which you created. What do you meant by nothing is happening ? Are you getting any error ?
dream_liner_7e7 wrote: how i can use parameter query to for insertcommand.
I believe the MSDN example which I given shows this. Isn't it ?
|
|
|
|
|
1> i need to insert data through accessdatasource
2> can i use parameterized queries to select or insert data
thanks in advance.
|
|
|
|
|
dream_liner_7e7 wrote: i need to insert data through accessdatasource
It has a InsertCommand property. Write your query there.
dream_liner_7e7 wrote: can i use parameterized queries to select or insert data
Yes. MSDN[^] has an example.
|
|
|
|