|
I want to display the text in the same form when submit btn is clicked.i need to display the image along with the text.i have 2 dropdown boxes n a text field.as i am new to ASp.net Programming
thanks in advance
|
|
|
|
|
Hi,
I'm going to assume that you are passing the text to the age through the page parameter "showtext" (page.aspx?showtext="what to show").
This first example has a button that shows the text:
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("ThisPage.aspx?showtext=text")
End Sub
Sub Label1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.PreRender
If Request.QueryString("showtext") <> Nothing Or Request.QueryString("showtext") <> "" Then
Label1.Text = request.QueryString("showtext")
End If
End Sub
To show the Image, I assume that you are passing the image location through the parameter "imageloc". It also has the button:
Sub Button1_Click(ByVal sender As Object, byVal e As System.EventArgs) Handles Button1.Click
Response.Redirect("ThisPage.aspx?imageloc=image1.png")
End Sub
Sub PictureBox1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.PreRender
If Request.QueryString("imageloc") <> Nothing Or Request.QueryString("imageloc") Then
PictureBox1.ImageLocation = Request.QueryString("imageloc")
End If
End Sub
|
|
|
|
|
Thanks for Your reply but i am using label to display text with Image.i have given the path for the image but i want to display the text on btn click which is retrived frm database.i have givenu small piece of code below
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
if (lblDisplayText.Text = "" && ddlsunsign.Text = "Aries")
{
return "../../DesignTier/SignImages/ariesstat.jpg";
}
.
.
.
.
.
.
}
catch (Exception ex)
{
ex.Message;
}
}
it wuld b very helpful for me if possible give code in C#.
Thanks in Advance.
|
|
|
|
|
Sorry
You could try this:
public string GetImagePath()
{
switch (ddlsunsign.Text) {
case Aries:
return "../../DesignTier/SignImages/ariesstat.jpg";
case Aquarius:
return "../../DesignTier/SignImages/aquariusstat.jpg";
case default:
return null;
}
}
public string GetStat()
{
switch (ddlsunsign.text) {
case Aries:
return
case default:
return null;
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (GetImagePath()!=null&&GetStat()!=null) {
Response.Redirect("ThisPage.aspx?imageloc=\"" + GetImagePath + "\"&text=\"" + GetStat() + "\"");
}
}
protected void descriptionLabel_PreRender(object sender, EventArgs e)
{
if (Request.QueryString("text")!=null) {
descriptionLabel.Text = Request.QueryString;
}
else {
descriptionLabel.Text = "Error";
}
}
protected void signImage_PreRender(object sender, EventArgs e)
{
if (Request.QueryString("imageloc")!=null) {
signImage.ImageLocation = Request.QueryString("imageloc");
else {
signImage.ImageLocation =
}
}
|
|
|
|
|
Here is the old code in C#:
protected void button1_Click(Object sender, EventArgs e) {
Response.Redirect("ThisPage.aspx?showtext=text&imageloc=loc");
}
protected void label1_PreRender(object sender, EventArgs e) {
if (Request.QueryString("showtext")!=null||Request.QueryString("showtext")!="") {
label1.Text = request.QueryString("showtext");
}
}
protected void pictureBox1_PreRender(object sender, EventArgs e) {
if (Request.QueryString("imageloc")!=null||Request.QueryString("showtext")!="") {
pictureBox1.ImageLocation = Request.QueryString("imageloc");
}
}
|
|
|
|
|
Hi
I have created a form view which allows records to be inserted to a table.
The insert code is automatically generated by data Source Definition.
When I select the insert button the data on the form disappears but the table is not updated.
How can I debug automatically generated insert code and how can I display SQL log to see
what happening ?
Thanks
|
|
|
|
|
if you are using sql server then use sql profiler.
Regards
Shajeel
|
|
|
|
|
I am using SQL Express is there a SQL Profiler available for this product and how do I start it ?
I don't have the option in my available programs
|
|
|
|
|
Hi,
I am looking for a way to insert text into a TextBox at the current position, as I am trying to make an site to create web pages with Google stuff (like Maps, Search).
I know that you can do
TextBox1.Text.Insert(1, New IO.StreamReader("Maps.txt").ReadToEnd) , but I need to replace 1 with the current cursor position in the TextBox.
It is being written in VB, but I can do a little bit of C#.
Thanks
|
|
|
|
|
hi guys i was just wondering if vb.net can use the standard provider feature of asp.net(the one taht allow user to login logout, rolemanagement)
and how
thx
|
|
|
|
|
Are you asking if you can use the default providers in windows application ?
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
|
This is bit tricky, Need to look at it. In the mean time if you come across the solution let me know !!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
no problem will do more research about it
|
|
|
|
|
Hi,
I have a doubt on uploading some files to the server, here's my codes
Dim fn As String = System.IO.Path.GetFileName(Me.flPrintScreen.PostedFile.FileName)
Dim SaveLocation As String = "\\\\10.xx.xx.xx\\MyFolder\\" & fn
If Not fn = "" Then
Me.flPrintScreen.PostedFile.SaveAs(SaveLocation)
End If
It works well on my development machine which the file is being uploaded to the server. But I wonder when I put it up on the Internet, whether the way I am using now is workable since this seems like mapping the drive locally.
Thanks.
J Liang
|
|
|
|
|
First and foremost check permission for the IUSER needs to be set properly for the shared drive !!! Let me know in case if you get some error !!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Hi Jaiprakash,
So as long as the permission is given, the code should work when I upload it to the server to be access by the user?
J Liang
|
|
|
|
|
Can you past the exact error message?
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
Hi Jaiprakash,
Actually there is no error message though, it works fine, the files are being uploaded accordingly, my concern is whether this would happen the same way when I uploaded my web pages to the server.
J Liang
|
|
|
|
|
Yes Liang, It will happen in that case !!!
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
your code seems correct.
May be you need map saving path using Server.MapPath(SaveLocation)
|
|
|
|
|
Hi Naveed,
I came across the Server.MapPath too, so from what you say, the code should work when I upload it the server to be access by the public?
J Liang
|
|
|
|
|
Well i told you this as i am using this statement and its working with me.
You need check according to your scenario.
|
|
|
|
|
Hi Naveed,
Thanks, I shall explore myself whether it works in my scenario
J Liang
|
|
|
|
|
for finding matched pattern in strings i am using the function Regex.Matches().
the issue is that if i am passing a "pattern" string which have bracket"( )" then it will not return any matches..
for eg:
string strInput = "PaperIndex (India) Private Limited";
string strPattern = "PaperIndex (India) Private";
and if i am passing this value to function it will not return any match.
foreach (Match Mth in Regex.Matches(strInput , strPattern, RegexOptions.IgnoreCase))
{
arrBuyleadName.Add(Mth.Value);
}
if we pass strPattern = "PaperIndex";
it is returning the match value as paperindex
if any body know how to avoid this issue, help me
thanking you,
Jes.
|
|
|
|