Jump to content
Xtreme .Net Talk

sj1187534

Avatar/Signature
  • Posts

    113
  • Joined

  • Last visited

Everything posted by sj1187534

  1. Hi... I have 2 secure folders, say 'user' and 'admin'. I specify two web.config files within the folders with the autorization tag containing -- <deny users="?"> --. The problem is they have two different login pages. How can I redirect them to their corresponding login pages using the <authentication> tag?? I have been thinking about this for a while but couldn't come up with anything except making the two login pages same. This seems fine since there are only two types of users in this case. What if we have 4 or 5 types of users??? SJ.
  2. Hi..thanks for the reply. I actually figured out what was wrong. The paging code was fine but there was a small logic error in the ItemDataBound subroutine for the datagrid. I was not changing the itemindex based on the pageindex of the datagrid. I was using: Private Sub dgrFree_ItemDataBound(...) .. Dim dr As DataRow = Me.dgrFree.DataSource.Table.Rows(e.Item.ItemIndex) ... End Sub instead of : Private Sub dgrFree_ItemDataBound(...) .. Dim dr As DataRow = Me.dgrFree.DataSource.Table.Rows(Me.dgrFree.CurrentPageIndex * Me.dgrFree.PageSize + e.Item.ItemIndex) ... End Sub The CurrentPageIndex was chaging fine but the item index were still starting from '0'. So, the same results are showing up on each page. SJ
  3. I am testing for the IsPostBack condition and the enableviewstate is enabled too. I just dont get it!!! The same concept is working on one page but not on the other!!!!! One thing I observed is, on the page that it is not working, I am using ItemDataBound on the datagrid. As you might have guessed, I am not using the ItemDataBound on the page it is working. Does that make any difference by any chance? SJ
  4. Hi...It is working if I am specifying the width of the textbox in pixels. But what I want to know is the significance of the %. SJ
  5. What do you mean highlighting it? Changing its color? SJ
  6. Hi...I have small question on the textbox control. How do we assign the width of the textbox to be the width of the table cell it is in. I thought "width=100%" takes care of it. <td width="100"><asp:textbox id="some" width="100%"></asp:textbox></td> But this is not giving what I want. What I understood from the results is the textbox width is such that the whole string that i am loading into it is occupied. Trying to explain it in a different way: In the example above, even though the width of the table cell is 100px, if the string to be loaded into the textbox is 150px, the textbox is automatically expanding to 150px!!! I hope u understood what the problem is!! Is there any way to get around this?? Thanks SJ
  7. Yes.I am pretty sure everything else is working fine. Just the smartnavigation issue.
  8. I am using the Server.Transfer() method. Bucky : I cannot use the meta refresh since I am performing this action at the button click event. SJ
  9. Hi....Can anyone tell me if there are any issues with the SmartNavigation attribute of a page. I include the "SmartNavigation=true" tag in the page directive but for some reason, when i am click on some link in that page, the page is going blank and it is not taking me to the requesting page. So, I tried to view the Source of the blank page and it looked like this. <BODY><ASP_SMARTNAV_RDIR url="/sample.aspx?aq=dallas&c=spb&z=%&l=%"></ASP_SMARTNAV_RDIR></BODY> Actually the sample.aspx is the page I requested but it still remains the original page with the above code in the source. Note: This is the only code that it is showing the blank page. Thanks SJ
  10. Is it something like this: <%# Left(DataBinder.Eval(Container.DataItem, "phone_date").ToString(),10) %> I used the previous method myself but I got the data in the String format. So, I didn't have any problem. SJ
  11. Hi..I think you can do that like this: <%# Left(DataBinder.Eval(Container.DataItem, "phone_date"),10) %> Let me know if it works. SJ.
  12. No..It is not at all concerned with SQL server. I am just trying to merge some text files into a single file periodically. SJ
  13. Problem solved. I just needed to modify one small thing in this line: If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then to If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.EditItem Then Thats it. Thanks SJ
  14. Hi...I am trying to implement edit information in-place in a datalist. I have an edit button for each item in a datalist and when the user clicks this button, the editing form opens up which should show the current information in its fields. Now, here's the problem. We can achieve this by using the <%# DataBinder.Eval(...) %> when loading the datalist. But what happens if we are loading the data from the ItemDataBound instead of the "DataBinder" thing. I mean...if you have a value from the datasource and we need to select the corresponding item in a dropdownlist in the editing form...what do you do? To understand more clearly, please take a look at the code I am working on: ========================================================= Private Sub dlSpecials_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlSpecials.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim dr As DataRow = Me.dlSpecials.DataSource.Table.Rows(e.Item.ItemIndex) ' ---------------------------------------------------- ' Load controls in the "EditItemTemplate" section ' ---------------------------------------------------- If e.Item.ItemIndex = Me.dlSpecials.EditItemIndex Then ' Recurrance criterion checkbox Dim chkrecur As CheckBox = CType(e.Item.FindControl("chkbRecurr"), CheckBox) If CBool(dr.Item("recurring")) = True Then chkrecur.Checked = True Else chkrecur.Checked = False End If ' Time Dim usctime1 As Time = CType(e.Item.FindControl("Time1"), Time) usctime1._Time = dr.Item("from_time").ToString().Split(" ")(0) usctime1._TimeSpan = dr.Item("from_time").ToString().Split(" ")(1) Else ' ---------------------------------------------------- ' Load controls in the "ItemTemplate" section ' ---------------------------------------------------- ' Time Dim lbtime As Label = CType(e.Item.FindControl("lblTime"), Label) lbtime.Text = dr.Item("from_time").ToString() & " to " & dr.Item("to_time").ToString() End If End If End Sub ========================================================= Thanks SJ
  15. Hi...I didn't understand the part where you said "How can I bind radiobuttonlist to dataGrid?"...I take that you want to bind the data from the dataset to a radiobuttonlist. Isnt't it? If that is the case, I think we cannot give a dataset or a datareader as a DataSource to the radiobuttonlist. You can do it this way: Querying on the Northwind database: ======================================================= '1. Create a connection Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) '2. Create the command object, passing in the SQL string Const strSQL As String = "select top 10 * from orders" Dim myCommand As New SqlCommand(strSQL, myConnection) Dim ds As New DataSet 'Set the datagrid's datasource to the datareader and databind myConnection.Open() Dim da As New SqlDataAdapter da.SelectCommand = myCommand da.Fill(ds) myConnection.Close() Dim dr As DataRow For Each dr In ds.Tables(0).Rows Dim li As New ListItem(dr(0), dr(0)) Me.RadioButtonList1.Items.Add(li) Next ======================================================= SJ
  16. Hi....I was wondering if there is any way to run a specific program periodically. I am planning to merge data from multiple number of files into a specific file and this has to happen everyday at sometime. How do you think I can approach this? Thanks. SJ
  17. Hi...Thanks for the code. Infact, my code is working with a small change that I have made. Instead of using Server.URLEncode, I used HTTPUtility.URLEncode when passing the encrypted string into the URL like this: "./sample.aspx?id=" & HttpUtility.UrlEncode(CryptoUtil.EncryptTripleDES(dr.Item("idnum"))) But when I am trying to read from the querystring, I am not using any HTTPUtility.URLDecode. Like this: CInt(CryptoUtil.Decrypt(Request.QueryString("id"))) Everything is working great. Thanks SJ
  18. Hi..That is not working either. All the encoding and decoding is making the '+' character vanish!!! And I am having this problem for the '+' char alone. I have'nt come across anything else yet. So, I cannot write any code to replace the '+' char with whatever ascii value it has. Do you know any two-way encryption algorithm that does not give any special characters in the encoded string. For ex: the MD5 and SHA1 encryption algorithms returns the encrypted strings in alphabets and numbers only. But both of them are one-way encryption algorithms!! SJ
  19. Hi...I am having a problem with datafrid paging...Here's the code that i am using : Private Sub dgrFree_PageIndexChanged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgrFree.PageIndexChanged Me.dgrFree.CurrentPageIndex = e.NewPageIndex BindData(GetDataByCategory("free")) End Sub Private Function GetDataByCategory(ByVal cat As String) As DataSet Dim ds As DataSet Dim catb As New B ds = catb.SearchByCategory(cat) Return ds End Function Private Function BindData(ByVal ds As DataSet) If Not ds Is Nothing Then Me.dgrFree.DataSource = ds.Tables(2).DefaultView Me.dgrFree.DataBind() Else Me.dgrFree.DataSource = Nothing Me.dgrFree.DataBind() End If End Function The index of the page is changing but it shows the first page all the time. I think there is some problem in re-loading the datagrid. Thanks SJ
  20. Nope...Thats not working either!! SJ
  21. Hi...It is not working. For some reason, the character '+' in the encoded string is vanishing even when HttpUtility.HtmlDecode() is used on the encrypted string. Is there any significance for the '+' char in the querystring? SJ
  22. Hi...Does anyone know any two-way encryption algoritm. I have been trying to use the DES and the TripleDES algorithms but the problem with these is I am not able to pass the encrypted string through the querystring as the encrypted string has some special characters in it. Any ideas? For instance when I am trying to encrypt the number "126" using DES encryption method, the encrypted string is 'lng0+5+6Utk=' which cannot be passed through the querystring because of the '+' character. I dont know why!! SJ
  23. I have this code that I used a long time before. This is a class to send an e-mail throught VB.NET ========================================================== Imports System.Web.Mail Public Class SendMail Private emailID As String, thisBody As String, thisSubject As String Private fromAddr as String, Smtp As SmtpMail '======================================================= ' Create a new E-Mail object taking the input parameters: ' toAddr -> E-Mail ID to send the mail to ' fromAddr -> From E-Mail address ' body -> Body of the email as string ' subj -> Subject as string '======================================================= Public Sub New(ByVal to As String, ByVal from As String, ByVal body As String, ByVal subj As String) emailID = to thisBody = body thisSubject = subj fromAddr = from Smtp.SmtpServer = "" ' SMTP server address here End Sub '======================================================= ' Send the E-Mail '======================================================= Public Function Send() Dim msg As MailMessage = New MailMessage msg.Body = thisBody msg.From = fromAddr msg.To = emailID msg.Subject = thisSubject Smtp.Send(msg) End Function End Class ========================================================== In your case, you can use it this way: dim mymail as New SendMail("to@mail.com", "from@mail.com", strOutput, "sample mail") mymail.Send() SJ. ---------------------------
  24. I have been working on some .NET sites lately and I always came across the same issue. Whenever I am testing on a live site, the validators are never fired when we leave a web control with an incorrect input data. It only fired when I submit the form!! If this is the issue of the javascript file being in the "asp_client" sub directory, how can we govern that? The hosting servers should take care of that, istn't it? So, I thought, this is how it is supposed to work on a live site. Any ideas? SJ
  25. Hi....Thanks for the reply. I have one question though. I understood that we can use the itemindex to load the label from the dataset. But, that is not what I meant in my previous post. What I am trying to comprehend is how do we pass the dataset to the ItemDataBound method of the datalist. In your example, you are just using the "dataset" directly but where does it come from. Is it the same dataset that we used to bind the datalist??? Or is it something else. If it is the same, do we have to go with the same name of the dataset? The only code I have is what you gave me in your previous post!! I am really confused here. SJ
×
×
  • Create New...