|
I am looking for a recommendation as to which control to use, when facing a new platform there are a number of controls that will do the job, which one is best for a particular job can take some time to define. I was hoping to shortcut that work.
I used a listview, still looking for ideas on the 'chicken tracks' navigation requirement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes.. According to my recommendation I would have created all html myself to have a better grasp on the code which is transferred to the Clients.
I would go for asp:Repeater .
|
|
|
|
|
Abhishek Sur wrote: I would go for asp:Repeater.
Ah bugger - now I have to go and look at the dammed repeater thingy.
Thanks Abhishek
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
I used the below coding to save and image into MS-Access Database as Binary Data. Now How to again load an image back from database to ImageBox with the same method of this coding?
<br />
Dim photoStream As Stream = ImageUpload.PostedFile.InputStream<br />
Dim photoLength As Integer = ImageUpload.PostedFile.ContentLength<br />
Dim photoMime As String = ImageUpload.PostedFile.ContentType<br />
Dim photoName As String = Path.GetFileName(ImageUpload.PostedFile.FileName)<br />
Dim photoData() As Byte = New Byte((photoLength) - 1) {}<br />
photoStream.Read(photoData, 0, photoLength)<br />
Dim cmd As New OleDbCommand("insert into ImageTable(ImageName,ImageData) values(?,?)", DataConn)<br />
cmd.Parameters.AddWithValue("", photoName)<br />
cmd.Parameters.AddWithValue("", photoData)<br />
DataConn.Open()<br />
cmd.ExecuteNonQuery()<br />
DataConn.Close()<br />
Response.Write("Image Added")<br />
IT Professional.
Work till you get it!
|
|
|
|
|
|
Hello.
Ive Tried your given code but im having errors that my insert statement is not correct .. i cant find what is not correct with my statement .. here is my code
If PhotoUpload.HasFile Then
Dim photoStream As Stream = PhotoUpload.PostedFile.InputStream
Dim photoLength As Integer = PhotoUpload.PostedFile.ContentLength
Dim photoMime As String = PhotoUpload.PostedFile.ContentType
Dim photoName As String = Path.GetFileName(PhotoUpload.PostedFile.FileName)
Dim photoData() As Byte = New Byte((photoLength) - 1) {}
photoStream.Read(photoData, 0, photoLength)
Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TestImage.mdb; Persist Security Info=True")
Dim cmd As New OleDbCommand("INSERT INTO ImageTable(ImageName,Image) VALUES(?,?)", cnn)
cmd.Parameters.AddWithValue("", photoName)
cmd.Parameters.AddWithValue("", photoData)
cnn.Open()
cmd.ExecuteNonQuery()
Response.Write("Image Added")
End If
hope you can help me
|
|
|
|
|
Hi used the below coding for enrypting and decrypting a text. But with this i dont know how to save to a database, when i tried i am getting many errors. How to do this?
Private Sub cmdEncrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
' Encrypt<br />
MyText = Encrypt(textbox1.text, "aabc123a") ' Here aabc123a is the key and textbox1.text is the text which you want to encrypt<br />
End Sub<br />
<br />
Private Function Encrypt(ByVal strText As String, ByVal strEncrKey As String) As String<br />
Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}<br />
Try<br />
Dim bykey() As Byte = System.Text.Encoding.UTF8.GetBytes(strEncrKey)<br />
Dim InputByteArray() As Byte = System.Text.Encoding.UTF8.GetBytes(strText)<br />
Dim des As New DESCryptoServiceProvider<br />
Dim ms As New MemoryStream<br />
Dim cs As New CryptoStream(ms, des.CreateEncryptor(bykey, IV), CryptoStreamMode.Write)<br />
cs.Write(InputByteArray, 0, InputByteArray.Length)<br />
cs.FlushFinalBlock()<br />
Return Convert.ToBase64String(ms.ToArray())<br />
Catch ex As Exception<br />
Return ex.Message<br />
End Try<br />
End Function<br />
<br />
Private Sub cmdDecrypt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click<br />
MyText = Decrypt(TextBox2.Text, "aabc123a")<br />
End Sub<br />
<br />
Private Function Decrypt(ByVal strText As String, ByVal sDecrKey As String) As String<br />
Dim IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF}<br />
Dim inputByteArray(strText.Length) As Byte<br />
Try<br />
Dim byKey() As Byte = System.Text.Encoding.UTF8.GetBytes(sDecrKey)<br />
Dim des As New DESCryptoServiceProvider<br />
inputByteArray = Convert.FromBase64String(strText)<br />
Dim ms As New MemoryStream<br />
Dim cs As New CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write)<br />
cs.Write(inputByteArray, 0, inputByteArray.Length)<br />
cs.FlushFinalBlock()<br />
Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8<br />
Return encoding.GetString(ms.ToArray())<br />
Catch ex As Exception<br />
Return ex.Message<br />
End Try<br />
End Function<br />
<br />
Remember to add top of import: Imports System.Security.Cryptography
IT Professional.
Work till you get it!
|
|
|
|
|
Tell me what error you are getting ?
The code looks ok to me.
|
|
|
|
|
How do i make the menu selected item have a different color? tabbed menu
I am using the ASP.NET MVC default template.
Well i want the menu i'm in to have a different color.
Found this in the css but it does not produce any results. I've searched around the web, most people have solutions that require you to modify the menu alltoghether, having a variable to keep "tabs" on what is selected. Why isn't this working by default?
ul#menu li.selected a
{
background-color: #fff;
color: #000000;
}
|
|
|
|
|
Hi
You can use this css code
ul#menu li a:Hover
{
background-color: #fff;
color: #000000;
}
I dont understand what you mean in this code
ul#menu li.<big>selected</big> a
{
background-color: #fff;
color: #000000;
}
I think that LI element does not have selecting capability
If you want to use Pseudo-class you should write like
ul#menu li:selected
but I am not sure that selected be a Pseudo-class
Mohammad Khansari
|
|
|
|
|
I stumbled over this too. In order to use the "selected" style for the tab in the standard MVC site.css file, you need to have the selected class be assigned to the <li> rather than the <a> tag.
ul#menu li.selected a
{
background-color: #fff;
color: #000000;
}
So to show the About item selected, for your menu use:
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home")%></li>
<li><%= Html.ActionLink("Sites", "Index", "Sites")%></li>
<li class="selected"><%= Html.ActionLink("About", "About", "Home")%></li>
</ul>
|
|
|
|
|
I'm trying to migrate a web site to an azure application, and when I try to compile, it doesn't see the dropdown list controls on the web forms.
Why is that?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Dropdown Lists (and List Boxes) are windows forms controls sucked into the browser by Microsoftie magic. and (WAG) either won't be rendered the same way in Azure, or haven't been migrated yet.
|
|
|
|
|
Check this where Rodger[^] mention some of the issues which were absent in Development env.
I think there might be some weird behavior found by many of them after updating to Azure.
|
|
|
|
|
How do I print information displayed on a gridView or inside a panel for example with either server script or client script without printing the whole page.
I use window.print() method but the whole page is printed out, I don't want that. I want a specific region of my .aspx page.
Thank you all.
Tunsten
|
|
|
|
|
Hi
You can create a new window on client side.
var pp = window.open('', '', 'left=0,top=0,toolbar=0,scrollbars=1,status=1');
and use innerHTML property to insert print text or html
pp.document.body.innerHTML += cPrint;
after that use window.print() for new window
Mohammad Khansari
|
|
|
|
|
But I don't seem to get you write. I mean to print out specific area (maybe information displayed on a DIV tag for example) from the page.
Tunsten
|
|
|
|
|
hi
Here is complete code
var pp = window.open('', '', 'left=0,top=0,toolbar=0,scrollbars=1,status=1');
pp.document.body.innerHTML += cPrint;
pp.document.close();
pp.focus();
pp.print();
I think that it works properly
Mohammad Khansari
|
|
|
|
|
Hello everyone,
How do I get the ID of a server control with JavaScript code?
I am trying to do client-side validation with JavaScript before it's processed on the server, the code I used didn't work and I did't get error. Below is the code I used:
// the JavaScript function
function ValidateAssetCategory() {
var catID = document.getElementById("txtCatID").value;
if (catID == null) {
alert("Please enter category ID");
return false;
}
}
// the aspx source code
<asp:LinkButton ID="lbSave" runat="server" OnClientClick="ValidateAssetCategory();" onClick="lbSave_Click">Save</asp:LinkButton>
only the server code is executed.
Thanks for your understanding...
Tunsten
|
|
|
|
|
tunsten wrote: var catID = document.getElementById("txtCatID").value;
As you have said you need to get ID of Server Side Control, you have to do the following :
Var CatClientID="<%=txtCatID.ClientID%>"
function ValidateAssetCategory() {
var catID = document.getElementById(CatClientID).value;
if (catID == null) {
alert("Please enter category ID");
return false;
}
}
Hope this will help you.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
I did it but the client script still didn't work. How I am I suppose to put the server script? I used
<asp:linkbutton id="lbSave" runat="server" onclientclick="ValidateAssetCategory();">Save
what other option please?
Tunsten
|
|
|
|
|
document.getElementById("<%=txtCatID.ClientID%>").value
|
|
|
|
|
then, how do I code the linkbutton?
is it
<asp:linkbutton id="lbSave" runat="server" onclientclick="ValidateAssetCategory()" onclick="lbSave_Click">
if it is, I have tried it but did not work. only the server script (lbSave_Click) is executed.
help me out.
Tunsten
|
|
|
|
|
Just replace
<asp:LinkButton ID="lbSave" runat="server" onClientClick="ValidateAssetCategory()" onClick="lbSave_Click" />
with
<asp:LinkButton ID="lbSave" runat="server" onClientClick="return ValidateAssetCategory()" onClick="lbSave_Click" />
And from your Javascript function ValidateAssetCategory return true if you need server side to execute, otherwise put false.
function ValidateAssetCategory()
{
if(...) return true;
else return false;
}
Cheers.
|
|
|
|
|
It works fine now with your guide. Thanks.
Tunsten
|
|
|
|