
mr relaxo
Avatar/Signature-
Posts
53 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mr relaxo
-
If you're using a dataset you could just loop through it and change repeating values to empty strings before you bind it to your grid. This assumes that you ORDER BY fname. e.g Dim dr As DataRow Dim thisrow, lastrow As String For Each dr In ds.Tables("yourdatatablename").Rows lastrow = thisrow 'set variables to same value thisrow = dr.Item("fname") 'change thisrow to next datarow in the loop If thisrow = lastrow Then 'if they're equal you have repeating values so... dr.Item("fname") = "" dr.Item("lname") = "" etc... End If kinda crude, but its easy.
-
try <script language="vb" runat="server"> sub page_load(Source as object, E as EventArgs) if session("isusergood") is nothing then response.redirect("unauthorised_user_page.htm")
-
response.redirect("nameofpageyouwanttoreload.aspx") that'll reload your page from the server. newly created session variables aren't available till after postback.
-
also, if you're using bound columns as opposed to autogeneratecolumns then you have to add a sort expression property to each bound column you want to enable sorting on. for example <asp:BoundColumn DataField="quantity" SortExpression="quantity" HeaderText="Quantity"></asp:BoundColumn>
-
thanks for the help. I unchecked the automatic formatting options but it still insists on removing the tag. The best I could come up with is to comment out the line while working on the page, which stops it from being deleted. A bit less inconvenient than having it deleted all the time. ta, Kris.
-
I have the folllowing tag in an ascx page <param name="movie" value="flash\bmvtext.swf" /> every time I go to make any change on that page visual studio deletes the tag. the file wont play without it and its really annoying have to stick it back in there every time i make the tiniest change to the page. Anyone know how i can stop vs from doing this? tnx, Kris.
-
you can call a function to populate your drop down list with different data to what your binding your datalist to. <asp:listbox id=blah runat=server datasource="<%# fiillmybox() %>" /> and then your function would return a datatable or whatever is appropriate to bind to your control. i may have misunderstood your problem tho, its very a.m :p
-
inside your listbox tag SelectionMode="multiple"
-
You could use a datagrid or datalist control to give you a button for each record in the database.
-
Once you postback any control you create dynamically no longer exists. Why do you need to create it dynamically?
-
how about just storing the page they came from in a session variable like session("lastpage") = request.currentexecutionfilepath and then after a successful login just return them to that page Server.Transfer(Session("lastpage"))
-
hi, I'm working on a clothing website and what im trying to do is have a listbox of sizes for each colour an item has. I create the listboxes dynamically based on the number of colours which works fine but I dont know how to access them when I try to add their selected items to the order. Could someone explain how I can access those controls and find each item that has been selected? I've pasted the code for creating the controls below. Thank you Dim lbxdynamicsizes As ListBox For i = 0 To chkcolours.Items.Count - 1 lbxdynamicsizes = New ListBox() lbxdynamicsizes.ID = "lbxsize" & i lbxdynamicsizes.SelectionMode = ListSelectionMode.Multiple lbxdynamicsizes.Rows = 2 lbxdynamicsizes.DataSource = ds.Tables(1) lbxdynamicsizes.DataTextField = "sizes" panelsizes.Controls.Add(lbxdynamicsizes) Dim spacer As LiteralControl = New LiteralControl("<br>") panelsizes.Controls.Add(spacer)
-
You could store whatever values you want to keep from the existing cookie in variables then rewrite the cookie so you dont lose any information you wanted.
-
updating database after dataset Merge
mr relaxo replied to mr relaxo's topic in Database / XML / Reporting
ok nevermind, i didnt really need to merge them in the first place. :D -
Hi,Im trying to do an insert to the database with a dataset that has been merged with another dataset containing the new record i want to write. The merge works no problem but the database isnt updated. the code works for tables without any primary keys but causes a constraint violation for a table with a primary key. Here is the code for the insert function: Public Function dsinserter(ByRef ds As DataSet, ByVal strsql As String, ByVal xds As DataSet) As Boolean Dim objconn As New OdbcConnection(getconstring) Dim objadapter As New OdbcDataAdapter(strsql, objconn) Dim cb As New OdbcCommandBuilder(objadapter) Try objadapter.AcceptChangesDuringFill = False objadapter.Fill(xds, "details") xds.Merge(ds.Tables("details"), false, MissingschemaAction.Ignore) objadapter.Update(xds.Tables("details")) Return True Catch e As Exception msLastError = e.Message Return False End Try End Function Ive done alot of searching for answers but without any luck. Any ideas on how i can get this to work with a table which has a primary key? Thank you.
-
repeating values in drop down list
mr relaxo replied to mr relaxo's topic in Database / XML / Reporting
Thanks alot Robby, the two separate sql statements worked great. Im only displaying the related colours and sizes for any one product at a time. Is that what you meant in your last reply? Or do you think I should repopulate the sizes ddl depending on what colour is selected. Yeah thats probably a good idea. -
Hi, I am trying to do a product details page for a clothing site. I am placing colours and sizes in two drop down list boxes. The problem i am having is that i get a lot of reapeating values as a result i.e for each colour there are a number of different sizes so i get ddlcolours ddlsizes navy x navy s navy m black x black s etc etc. Can I make the ddl's only show unique values or do I need to rethink my SQL statement? Dim strSQL As String = "select distinct px.filename,p.description, c.description as 'colours',s.description as 'sizes' from productsXcolours px " _ & "INNER JOIN products p ON px.productID = p.productID " _ & "INNER JOIN colours c on px.colourID = c.colourID " _ & "INNER JOIN productsxsizes pxs ON p.productID = pxs.productID " _ & "INNER JOIN sizes s ON pxs.sizeID = s.sizeID " _ & "where px.productID = '" & (prodID) & "' ;" thank you for your time. :D
-
the permissions for the folder that the excel file is in might need to be changed to give the aspnet account access to the file. Im just guessing but I had to to that once in order to get an access db to work.
-
in the code behind your login page you put something like Dim validate As businesslayer.security validate = New businesslayer.security(txtID.Text, txtPassword.Text) 'this calls your business rules layer in your business rules: Private data As New datalayer.access() (or whatever your class is named) Public Sub New(ByVal CustomerID As String, ByVal Password As String) validatefunction(CustomerID, Password) End Sub private sub validatefunction(ByVal CustomerID As String, ByVal Password As String) data.passwordcheck(customerID, password) (this is the call to the data acess layer) then once you have the data your business rules would validate it and probably return a true or false. Good Luck :)
-
Yes, you call you business layer to do the validation. the first thing that class with probably do is call the data access layer with a query like "select username,password from users where username = '" & (usrnamevariable) & '" and password = '" &(passwordvariable) & '". Then back in the business rules by validating the result i.e if 1 record is returned user == good else user == bad hope this helps :D
-
or you can use the asp.net datagrid which has the format of a table. very simple. in the body of your html you stick: <asp:datagrid id="dgresults" runat="server" /> then instead of this: oReader = oComm.ExecuteReader() put: dgresults.datsource = oComm.executereader() dgresults.databind () you dont even need the datareader object in this case.
-
Hey I was wondering if it was possible to use a table from one database eg. access - read a column such as "no_in_stock" and then use the values in that column to update a "no_in_stock" column in another database table eg. mysql. If anyone has some experience with this type of operation Id love to hear how you went about it or even if its possible. Thanks.
-
the session object stores variables in the web servers memory, which are destroyed when the session ends. You need to use cookies if you want to check if your user has logged in previously. So if your user had checked the box requesting they would like to be logged in automatically next time they visit, you would create the cookie with their username and password else just use session variables. info on cookies
-
do you have that 'handles' bit ?? Sub setpage (ByVal src As Object, ByVal e As DataGridPageChangedEventArgs) handles datagrid1.pageindexchanged