|
sudheera p wrote: I am new to PHP
This is ASP.NET Forum. It may help you if you post it in web development forum.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hello, this is my first post about such things and the reason for this is that i have to make some webparts in asp and i've tried everything but i can't make it work. What i need is a webpart that has a listbox with items generated after i get some info from another application and based on the selected index in the listbox a number of texboxes are generated. I then need to get the values from the texboxes after i click on a button. From what i've read on the internet I have to recreate the same tree of controls on every postback before viewstate loads so i called my control creation method in the OnInit event. The problem is that at that moment i can't retrieve the selected index of the listbox in order to know which and how many textboxes to create. I tried to store the selected index in session but the selected index changed event of the listbox fires up after the OnInit method so I always get the selected index in the previous case. I find very odd that the listbox does not remember its selected index on each postback and that I have to store it in Session because the viewstate loading event occurs after the OnInit one and from what I know it's best to recreate the dynamic controls in the OnInit method. So basically the information I need to create something is available only after that "something" needs to be created. I'm obviously looking at all of these wrong but it's my first asp .net project so...
This is some of the code, please advise:
protected override void OnInit(EventArgs e)
{
if (this.Page.Session["index"] != null)
ListBox1.SelectedIndex = (int)this.Page.Session["index"];
makeCtrls(ListBox1.SelectedIndex + 1);
base.OnInit(e);
}
public void makeCtrls(int n)
{
tbList.Clear();
for (int i = 0; i < n; i++)
{
TextBox t = new TextBox();
t.ID = n.ToString() + i.ToString();
t.EnableViewState = true;
this.Controls.Add(t);
tbList.Add(t);
}
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
makeCtrls(ListBox1.SelectedIndex + 1);
this.Page.Session["index"] = ListBox1.SelectedIndex;
}
|
|
|
|
|
hi
I am getting problem in IE 7 when i am running asp.net 2.0 project in local machine if u set any aspx page set as default and run it automatically taking dot(.) at the end of Url for example http://localhost/mysite/sigin.aspx. . how to remove the dot at the end? and how to set that will not take any page.
Regards
D.V.Mallikarjuna Guptha
|
|
|
|
|
string url = @"http://localhost/mysite/sigin.aspx.";
if (url.EndsWith("."))
{
url = url.Substring(0, url.Length - 1);
}
|
|
|
|
|
All literature I see on creating custom handlers deals with associating an extension with a handler, e.g. if I wanted a handler for Ajax requests, I could implement the IHttHandler interface in an AjaxHandler class.
Now, to have individual instances of AjaxHandlers, e.g. DocAjaxHander, PersonAjaxHandler etc. would I derive those from my base AjaxHandler?
|
|
|
|
|
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files.
plz help
|
|
|
|
|
Storing them on the file system certainly makes for less strain on your site, it depends on what your requirements are.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
if u store those images in a folder it will very easy. but some complexity also there if somebody delete that folder.
or else u can store images in database that is difficult but more flexible and relable.
so my suggetion is to store in database directly.
use below code to store the images in database.
If fileImgUpload.PostedFile.ContentLength = 0 Then
lblmsg.Visible = True
lblmsg.Text = "Please Browse for the New Image/Photo......."
lblmsg.ForeColor = Drawing.Color.Red
Exit Sub
End If
openAccessConnection()
Dim imageSize As Int64
Dim imageType As String
Dim imageStream As Stream
' 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
Dim imageContent(imageSize) As Byte
Dim intStatus As Integer
intStatus = imageStream.Read(imageContent, 0, imageSize)
Dim cmd As New OleDbCommand("insert into tblImg(img_title,img_type,img_stream) values(@img_title,@img_type,@img_stream)", myAccessConnection)
cmd.CommandType = CommandType.Text
cmd.Parameters.Add("@img_title", OleDbType.VarChar).Value = txt_title.Text.Replace(",", """")
cmd.Parameters.Add("@img_type", OleDbType.VarChar).Value = imageType
cmd.Parameters.Add("img_stream", OleDbType.LongVarWChar).Value = Convert.ToBase64String(imageContent)
cmd.ExecuteNonQuery()
closeAccessConnection()
txt_title.Text = ""
lblmsg.Visible = True
lblmsg.ForeColor = Drawing.Color.Green
lblmsg.Text = "Photo Uploaded Successfully......"
displayImages()
|
|
|
|
|
Subin Alex wrote: i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images?
I would suggest you to store images in folder and store the image path in database.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi,
I am looking for some menu samples that I can work through. I did try Google. If any one has some links please let me know.
What I am trying to achieve is if I have a navigation menu on the left, and a user clicks the link, then that link must be highlights and the background must be a different colour so that the user can see where he is, something similar to:
http://groups.google.com/group/rec.music.gdead/topics[^]
See Discussions top right.
Also, when a person hovers over the menu link there is a horrible javascript link in the bottom status of the browser, how do I get that away to display something more decent?
Can anybody help?
Brendan
|
|
|
|
|
|
Thanks Matthew, I will take a look at it
|
|
|
|
|
Hi all
In my application ,i have a button, modalpopup with 2 textbox and 2 buttons...if i click ok button without entering values to textboxes it will show the valodation message in the summary..i will close the modalpopup and open it again ,the summary is still there only..it is not cleared...
how to clear the message the validation summary inside a modalpopup?
|
|
|
|
|
Hi,
I have dropdownlist and gridview.When i select an item in drop down i bind the gridview.There is edit item template in girdview so i am able to edit a row.So i select a row to edit and i do not want to change the row,so again i select an item in dropdown and i have values in the grid.When i select the same item in dropdown the edited row is seen.
I do not want to show the edit item ie instead bind the grid without that edited item
if(ddl.selectedValue=="0")
dg.EdititemIndex=-1
BindGridView();
end if
please help...........
modified on Friday, March 20, 2009 4:42 AM
|
|
|
|
|
you asked this question before...
so still...what is your question?
I assume that you better check
if (dg.EditItemIndex > -1)
dg.EditItemIndex = -1;
BindGridView();
Your problem is the edit state of the gridview, not the changing value of the dropdownlist.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
i am not interested to edit the row so i check some other value in drop down and it shows the grid.So again i select the old value in dropdown.But the gridview shows the previously edited value..........
Please help
|
|
|
|
|
better debug you code and check the value for slectedValue of your DDL.
You might rephrase your question because it is not quit clear what you mean and what your problem is.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Sounds like you're saying when someone clicks on an item, you want to remove it from your datasource / What have you tried ? This code won't do that, obviously.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hai
I have a DataList control that contains dynamic information that I need to print out.
Here i need to perform page break while the content expanding into two pages with same header or complete border,how can i do that? plz send me the code
thank you
|
|
|
|
|
I have created a inputbox for user to login when my web page(.aspx) is loaded. This is whats happening when i run the application..
Internet explorer opens up and waits before loading the web form, only to realise that my inputbox is hidden behind, so i have to drag the dialog(internet exporer) away then i can see the input/dialog box.
How do i make it appear in front of the web page.
This is my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim strPasswd As String
If Not IsPostBack Then
strPasswd = InputBox("Enter the password please:")
End If
End Sub
thanks
|
|
|
|
|
Um... your basic problem is that you have no idea what you're doing. Buy a book on ASP.NET and try to understand what it is and what it does. It's plain that you have no clue.
Your input box shows on the server, not the client. You just can't tell that now, because they are the same thing. Using methods like InputBox sucks in general, but you sure as hell can't use it in ASP.NET.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thank you very much. yes you rite, this my first ASP.NET project, so i'm still learning these things.
|
|
|
|
|
No buddy. InputBox is a feature of Windows, you cant call them on your web page.
rather make an Inputbox yourself using HTML.
|
|
|
|
|
Try to use asp.net server controls for this(TextBox)
|
|
|
|
|
is it the same method for uploading the flash file as in the case of images?
|
|
|
|