|
I have an editable gridview with blank cells. User enters some numeric data in cells & clicks a button. My problem is that, as soon as button click event is fired, the page refreshes & the gridview becomes empty. Can anybody tell me, how can I save values in cache so that button click event does not result in loss of data. ?
|
|
|
|
|
Surely the point of the button is to store the values ? Where do the values get stored in general ? I'd expect the button to store the values in the DB and then the control to rebind to the data source.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
my database Ms Access has 3 fields as folllows;
id- number
imageName- text
imageURL- text
...................................................
I have a fileupload tool and a button names btnUpload which helps to upload images to a folder and that path gets saved in database field names imageURL.
.........................................................
Inherits System.Web.UI.Page
Dim constr As String = "Provider=Microsoft.jet.OLEDB.4.0; Data Source=D:\imgupload\db1.mdb;Persist Security Info=False;"
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
If FileUpload1.HasFile Then
FileUpload1.SaveAs(IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName))
fnSaveFile(IO.Path.GetFileName(FileUpload1.FileName), IO.Path.Combine(Server.MapPath("Image"), FileUpload1.FileName))
End If
End Sub
Public Sub fnSaveFile(ByVal FileName As String, ByVal FileURL As String)
Dim cmd As New OleDb.OleDbCommand
Dim con As New OleDb.OleDbConnection(constr)
Try
Dim strSql As String = "insert into tbl_Image(ImageName,ImageURL) values('" & FileName & "','" & FileURL & "')"
'------------"
con.Open()
cmd.Connection = con
cmd.CommandText = strSql
cmd.ExecuteNonQuery()
Catch ex As Exception
Response.Write(ex.Message)
Finally
cmd.Dispose()
con.Dispose()
End Try
End Sub
................................................................
my image uploading is working well. cud anyone sugesst me a way to add a gridview and show the image other than showing the path of the image.
|
|
|
|
|
Did you gone through the all the reply that was provided to you in your last post?
|
|
|
|
|
ya but I didnt understand or get any idea to change those to my requirement. plz help me
|
|
|
|
|
Pratheepa wrote: ya but I didnt understand or get any idea to change those to my requirement. plz help me
Well, posting the same question again, will get you the same answers. The problem is that you're not capable of doing this task. If this is homework, talk to your teacher. If this is paid work, tell your client that you are a fraud now, and save you and them further time and hassle. We answered you. If you can't understand it, that's not our fault.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Pratheepa wrote: ya but I didnt understand or get any idea to change those to my requirement.
|
|
|
|
|
If im understanding right then just put this in ur gridview on ur aspx page:
<img src='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' alt='<%# DataBinder.Eval(Container.DataItem, "imageURL") %>' />
|
|
|
|
|
thanks a lot. it really works.
|
|
|
|
|
please
i need a help on this
the chess game can have drag and drop interactivity for players to
make moves. Players can also nominate to play against one of a number
of chess engine, and also play an online friend and also play against the adminstrator
|
|
|
|
|
|
We mocked you to scorn the last time you asked this. In the time between, have you done anything to try to do your own project, or have you been begging other forums to do your work for you ?
I assume this is a school assignment. If you get the code from the web, how does that help you learn ?
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hi! I am currently creating a master page with a sidebar but I want the height of the sidebar to adjust by itself depending on the size of the page. The reason for this is that I am planning to place an background image on the sidebar so that it would always be visible throughout the page no matter how long the contents may be. What I am trying to achieve is similar to the sidebar of this(codeproject.com) website where the height of the sidebar(and its background) depends on the size of the contents of the page. Can anyone please help me with this? Thank you.
Regards,
Boggs
|
|
|
|
|
boggs wrote: What I am trying to achieve is similar to the sidebar of this(codeproject.com) website where the height of the sidebar(and its background) depends on the size of the contents of the page.
Use table, put content inside the table. Don't fix the height of the table. let it be depends on your content.
|
|
|
|
|
Okay... I'll try that. Thank you very much...
|
|
|
|
|
welcome! let me know if any other issue.
Thank you.
|
|
|
|
|
can't see automatic generated code (Cs file) for Dataset object .
any help
|
|
|
|
|
To see the autogenerated code
Select the project and click the "Show all files" option at the top of the solution explorer, then expand the dataset in the solution explorer
Any changes you make to that code will be overwritten if you chnge something in the dataset
Instead you should use a partial class
Alexei Rodriguez
|
|
|
|
|
Hola Rodriguez .
I don't find any Show all files icon in the Solution Explorer tab ,
I only have ( from left to right)
-properties
-refresh
-nest related files
-view class diagram
-copy website
-asp .net configuration
I even tried what i found in a forum about this problem :
Tools/import and export settings / reset all settings
Still doesn't work ..any suggestions ?
|
|
|
|
|
I made a simple gridview in asp.net using the code written below. Now I want to make it editable so that at run time user can enter some data. Also,I dont want to put a thing like "edit button" ,i.e a user can simply edit a cell as he does in an excel spreadsheet. Can anybody tell me which event make the gridview editable ( I am not using any database) ?
If possible, please give some code to help me understand.
protected void Page_Load(object sender, EventArgs e)
{
dt = new DataTable();
Char[] alpha = { '#', 'A', 'B', 'C', 'D', 'E'};
for (int i = 0; i < alpha.Length; i++)
{
dt.Columns.Add(alpha[i].ToString());
}
for (int i = 0; i < 1000; i++)
{
DataRow dr = dt.NewRow();
dr[0] = i + 1;
dt.Rows.Add(dr);
}
GridView1.BorderColor = System.Drawing.Color.FromArgb(0, 0, 0);
GridView1.DataSource = dt;
GridView1.DataBind();
}
modified on Saturday, June 6, 2009 3:56 PM
|
|
|
|
|
Create one gridview with all template field and set textbox for that template field when it displays the data it will display in textbox so that you can edit those field without click edit button.
Then you can access those textbox value when you click on a button.
Look at the following code to do so...
<asp:GridView ID="GridView1" runat="server" Style="z-index: 106; left: 93px; position: absolute;
top: 283px" Width="575px" EditIndex="1" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txt1" runat="server" MaxLength="3" Style="position: static" CssClass ="gv" text = '<%# Eval("slNo") %>'
AutoPostBack ="false" TabIndex ="0" Width="25px" Height ="15px" Visible ="true" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txt2" runat="server" MaxLength="3" Style="position: static" CssClass ="gv" text = '<%# Eval("Name") %>'
AutoPostBack ="false" TabIndex ="0" Width="250px" Height ="15px" Visible ="true" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txt3" runat="server" MaxLength="3" Style="position: static" CssClass ="gv" text = '<%# Eval("Address") %>'
AutoPostBack ="false" TabIndex ="0" Width="150px" Height ="15px" Visible ="true" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Then Place the following code in the button click event
for (int i = 0; i <GridView1.Rows.Count; i++)
{
GridViewRow gvr = GridView1.Rows[i];
string str1 = ((TextBox)gvr.FindControl("txt1")).Text;
string str2 = ((TextBox)gvr.FindControl("txt2")).Text;
string str3 = ((TextBox)gvr.FindControl("txt3")).Text;
}
after this you can use that string value to store into database or do further process.
|
|
|
|
|
|
|
Reposting your question each day will not help you get any reponses.
Rather that just throw out the code with vague message that it doesn't work, you should describe what the problem is. Not everyone has the time or desire to copy your code compiled it and debug it for you.
only two letters away from being an asset
|
|
|
|
|
Hi...
In my website uploaded some images and it will be successfully uploaded into the site.
But images cannot display in IE6 it will shows a white box with left hand side having a Red 'X' in this image spaces. But i will run in firefox it will display images...anybody give solution to this problem...
Thanks in Advance...
|
|
|
|