
mark007
Avatar/Signature-
Posts
185 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mark007
-
Take a look at the articles here: http://aspnet.4guysfromrolla.com/articles/040502-1.aspx In particular Part 8 (as well as being a useful concept in it's own right) covers the item databound event that you need to use. It also covers getting a reference to the delet button. In your case you will want to remove or hide the eidt button based on a test of the data in that row but the principle is similar. :)
-
You could look into the transfer method - that might do what you're after. :)
-
I guess C# is similar to PHP in that it has == for comparison and = for assignment. Should have realised. Thanks alot though. :)
-
Ah, thanks IgisKhan, I shall try that! :)
-
In that case I've tried that and it isn't the exact translation. Any more ideas?
-
What the difference between this: If (Not (string1 = string2)) Then 'some code here... End If and If (string1 <> string2) Then 'some code here... End If ?
-
Trying to understand some C# code on the net: if ((string1 = string2) != null) { } What is this saying? Translators recommend: if not (string1=string2) is nothing then end if Which is incorrect as string1=string2 is boolean. I therefore thought it might be: if string1<>string2 then but it seems to be doing more than this. Any ideas? :)
-
Ah excellent, thanks PlausiblyDamp. :)
-
I'm guessing probably not but you never know. Is it in anyway possible to get the windows username of the person accessing my page on an intranet? I figure it could be possible as the browser must be sending the info to use windows authentication... :)
-
To get the time now as a string use: Dim strTime As String = Date.Now.ToLongTimeString To get the differnce between 2 times as strings use: dim date1 as string = "23:43:32" dim date1 as string = "23:42:32" dim difference as string=New Date(0).Add(Date.Parse(date1).Subtract(Date.Parse(date2))).ToLongTimeString :)
-
Take a look at this. Should give you soem ideas as to how to implement it: http://aspnet.4guysfromrolla.com/articles/090402-1.2.aspx :)
-
You want to check out google maps - maps.google.com. Fantastic, better than any other online mapping program I've seen plus finds businesses and goves directions too! :)
-
OK, for anyone else coming across the same problem the way to do it is to include the code that sets up the bound columns in Page_Load everytime not just when you wish to databind. :)
-
Ok, so I managed to find a work around that worked by specifying the edit command button in the aspx html and the hiding it in code rather than adding it. However now when I come to do the Update using: Dim dDate As Date = System.Convert.ToDateTime(CType(e.Item.Cells(3).Controls(0), TextBox).Text) .cells(2) doesn't exist. In fact the only cell that exists is my one column specified in the aspx file for the editcommandbutton. Is there a way round this? or is the control just not made for adding columns at RT? :)
-
I have the following code: <asp:DataGrid id="dgData" runat="server" Visible="False" HorizontalAlign="Center" BorderStyle="Solid" BorderColor="Black" CellPadding="3" PageSize="50" AutoGenerateColumns="False"> <SelectedItemStyle BackColor="#C0C0FF"></SelectedItemStyle> <AlternatingItemStyle ForeColor="Blue" BackColor="White"></AlternatingItemStyle> <HeaderStyle Font-Bold="True" BackColor="#E0E0E0"></HeaderStyle> <PagerStyle Mode="NumericPages"></PagerStyle> </asp:DataGrid> Me.dgData.Columns.Clear() Dim cBound As System.Web.UI.WebControls.BoundColumn cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "ID" cBound.HeaderText = "ID" cBound.Visible = False Me.dgData.Columns.Add(cBound) cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "TaxYear" cBound.HeaderText = "Tax Year" Me.dgData.Columns.Add(cBound) cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "LEL" cBound.HeaderText = "LEL" Me.dgData.Columns.Add(cBound) cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "UEL" cBound.HeaderText = "UEL" Me.dgData.Columns.Add(cBound) If blEdit Then cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "Doer" cBound.HeaderText = "Doer" Me.dgData.Columns.Add(cBound) cBound = New System.Web.UI.WebControls.BoundColumn cBound.DataField = "Checker" cBound.HeaderText = "Checker" Me.dgData.Columns.Add(cBound) AddButtons() End If 'get data Dim ds As System.Data.DataSet ds = Me.DB.GetData("select * from LELandUEL") Me.lbTitle.Text = "Here is the data for Earnings Limits:" Me.dgData.DataSource = ds AddHandler dgData.ItemCommand, AddressOf Me.dgData_ItemCommand Me.dgData.DataBind() Private Sub AddButtons() Dim cEdit As System.Web.UI.WebControls.EditCommandColumn cEdit = New System.Web.UI.WebControls.EditCommandColumn With cEdit .ButtonType = ButtonColumnType.LinkButton .CancelText = "Cancel" .EditText = "Edit" .HeaderText = "Edit" .UpdateText = "Update" End With Me.dgData.Columns.Add(cEdit) Dim cDel As New System.Web.UI.WebControls.ButtonColumn With cDel .ButtonType = ButtonColumnType.LinkButton .CommandName = "Delete" .HeaderText = "Delete" .Text = "Delete" End With Me.dgData.Columns.Add(cDel) End Sub Private Sub dgData_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Select Case e.CommandName Case "Edit" Me.dgData.EditItemIndex = e.Item.ItemIndex BindData() Case "Cancel" Me.dgData.EditItemIndex = -1 BindData() Case "Delete" Case "Update" End Select End Sub The event is not firing. When I specifoed the columns in the aspx file and used autognerate for the bound columns it worked fine but with this dynamoc setup it doesn't work! Trace info if it helps:
-
Hmm, an array of array's like that might just work....
-
If I have 4 1 dimensional arrays each declared like: dim Array1(120) as Single Is there a faster way of combining them into 1 2-dimensional array declared: Dim ArrayAll(120,3) as Single other than looping through all 120*4 values? :)
-
Thanks, Iceplug. I'd not seen the bitshift operator before. Very useful! :)
-
If I have a long value what is the fastest way to create an array of bits representing it? For example if I have 1 I'll get: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 2 will give: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0 3 will give: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1 11 will give: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1 etc. By way of background I then want to sum this array and determine the max value if each 0 represnts an downward movement and each 1 represents an upward movement. Therefore if anyone can think of a better way of generating the 2^64 possible arrays that would also be useful. Speed is very important. Thanks. :)
-
Depends what you mean. There's nothing to stop you creating a class library in vb.net and accessing those classes in your asp.net app. Just add a reference to the project. :)
-
What's worng with .. in the img tag?
-
Well it's not a workaround as the pdf's are still in the folder so if the address was known they could be viewed. They have to be completely secure. I guess I could get all files handled by asp.nt. Though this would slow things down I guess it would work...
-
Ok, just tried it and doesn't seem to work. As suspected pdf files aren't processed by ASP.Net so it doesn't block them. If I add pdf to be processed by asp.net then it does block them - this isn't realistic though as I want to secure a directory, not file type. :)
-
OK, that sounds good. So am I on the right lines for actually showing the file with having a page that opens a stream to the file and then saves it to the Response.Outputstream? Can't say I've thought it through fully but I'm certainly hazy on this..