User Profile

Collapse

Profile Sidebar

Collapse
liawcv
liawcv
Last Activity: Jul 24 '10, 07:55 AM
Joined: Jan 9 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • liawcv
    replied to hide image if imageurl is blank
    Hi Frinny. Ya, I dare not post my codes here before I tried it out. It works : )
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to hide image if imageurl is blank
    Agree with what Frinny suggested. If compare against empty string (i.e. "") doesn't work, you may try to compare it against DBNull. Example:

    Code:
    <asp:Image ID="Image1" runat="server" 
        ImageUrl='<%# Eval("Picture", "~/Folder/{0}") %>' 
        Visible='<%# !(Eval("Picture") is DBNull) %>'
    />
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to How to Display data in textbox
    Use a temporary variable and perform string concatenation. This should get your problem solve. It is something similar to this:

    Code:
    Dim s As String = ""
    While y.Read()
        s &= y("Lastname") & " " & y("id") & " " & y("Firstname") & vbCrLf
    End While
    y.Close()
    textbox9.Text = s
    NOTE: String objects are immutable. Performing...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to Disabling validations
    user1980 -- Hi, I run your codes (the custom validator version) and find it works with few modifications:

    ----------

    1. You forget to set the "ValidationGrou p" property to "Submit" for some of the validators. For this reason, certain validators are not called when you hit the submit button.

    Solution: Set the "ValidationGrou p" property accordingly for all validators.
    ...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to Disabling validations
    RequiredValidat or may not suit your needs. Consider CustomValidator . Assign its "ClientValidati onFunction" property to the name of the JavaScript function that you created (i.e. client-side validation). Double-click on it, and write codes for its server-side validation.

    I assume that you want either both TextBoxes (namely TextBox1 and TextBox2) empty or both filled. The following are codes I wrote for both client-side validation...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to CheckBoxList Population and ToolTip
    Another workaround is to place a single CheckBox (note: CheckBox has a Tooltip property) within a multiple-row DataBound control such as GridView, DataList, Repeater, ListView, etc. When the page is running, you will get a group of individual CheckBoxes.

    To check which CheckBoxes have been checked, you will have to visit each data row one-by-one. A bit "dirty", but still workable... : )
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to CheckBoxList Population and ToolTip
    1 workaround is to add the item one-by-one using a loop, rather than performing data binding. The "tooltip" of a ListItem can be set through its "Attributes " collection as follow:

    Code:
    ListItem li = new ListItem("Text", "Value");
    li.Attributes["title"] = "Tooltip";
    There is a problem -- Unlike "Text" and "Value" properties, values set through...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to How to color in gridview
    Try if the GridView's RowDataBound event can fulfill your requirement:

    - Assume the GridView is named "GridView1" and the field contains the color names is named "Color". I would like to display the color in the 2nd cell (with index 1)...

    Code:
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
    ...
    See more | Go to post

    Leave a comment:


  • If what you want is simply the text displayed within a particular cell, the following may work:

    GridView1.Selec tedRow.Cells[3].Text

    Where the "3" is the index of the cell. Simply, 1st cell index 0, 2nd cell index 1, and so on. The code above will not work if you are using more complex column e.g. TemplateField, etc.

    For TemplateField, using FindControl(".. .") method e.g.

    Gri...
    See more | Go to post

    Leave a comment:


  • ---------- Reply Deleted ----------
    NOTE: Just realized your are using dynamic column. My suggestion may not work... :p
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to getting logged in user name
    If you are implementing forms-based authentication with correct authentication and authorization configuration, you should be able to get the current logged in person's username from the following methods:

    (1) By using the LoginName control.

    (2) Accessing to User.Identity.N ame property.
    See more | Go to post

    Leave a comment:


  • What is the purpose of getting the RowIndex? To perform a database update to that particular row? Or to calculate the vertical / horizontal total? Is the TextBox shown on editing mode or normal mode? These information may help others to understand your problem clearer.

    1. Simply to get the vertical total

    RowIndex is not essential if the purpose is to get the vertical total. You can recalculate the total every time the...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to checkboxlist problem
    Erm. Get your point... : )
    Here is the VB.NET version of manipulating the ArrayList:

    Code:
    ...
    Dim list As New ArrayList
    For Each i As ListItem In cblTestItem.Items
       If i.Selected Then
          list.Add(i.Value)
       End If
    Next
    Dim arr() As String = list.ToArray(GetType(String))
    Dim test_item As String = String.Join(",", arr)
    ...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to checkboxlist problem
    SQL Server? Generally... : )

    Code:
    // using System.Data.OleDb; <-- replace this with
    using System.Data.SqlClient;
    ...
    // string cs = "Provider=Microsoft..."; <-- replace this with
    string cs = "...";
    // where ... is connection string for SQL Server
    I think you may have to do some basic study on database access on your own. Cheer... : )
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to checkboxlist problem
    Suppose you're using MS Access database (named Sample.mdb and located at the App_Data folder of your Website), and the TEST table consists of 2 fields: TEST_ID (PK, auto number) and TEST_ITEM (text).

    Suppose a user is to select some items from the CheckBoxList cblTestItem. If he clicks on the button btnInsert, the selected list items will be formatted as a comma-separated string, and to be inserted into the TEST table's TEST_ITEM field...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to checkboxlist problem
    Hi, sandeepv. I think a loop plays a major role in solving your problem. Somehow, different implementations for different scenarios. More information is needed in order for us to understand your issue further... : )

    Give us some hints, such as:

    - Do you place your CheckBoxList within another control such as GridView, FormView, etc?

    - Do your CheckBoxList populates its list items based on a list of hard-coded...
    See more | Go to post

    Leave a comment:


  • Let your TextBox's ID is "TextBox1", the following JS retrieve the text of the TextBox:

    Code:
    // tested with IE7 and FF3 only
    var txt = document.getElementById("TextBox1");
    var s1 = txt.value;
    Let your DropDownList's ID is "DropDownList1", the following JS retrieve the selected item's value:

    Code:
    // tested with IE7 and FF3 only
    var ddl = document.getElementById("DropDownList1");
    ...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to checkboxlist problem
    <asp:CheckBoxLi st> control, by default, is already a multi-selection control. I guess, it may be the problem of how you have its data binding or select value... Erm...

    Please post your codes, perhaps part of your codes, so that we can understand your scenario further. Thanks... : )
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to Setting HttpContext.Current.User
    Not to query it from database on every page request. Extra information such as ROLE, FIRST NAME, LAST NAME, etc are to be stored on the authentication ticket as user data (i.e. store in cookie as encrypted info). For my case, in Global.asax, I instantiate a CustomIdentity (my Identity class) object based on the the user data in the authentication ticket. Something like (for my case):

    Code:
    ...
    FormsIdentity fi = (FormsIdentity)HttpContext.Current.User.Identity;
    ...
    See more | Go to post

    Leave a comment:


  • liawcv
    replied to Setting HttpContext.Current.User
    You mean store the entire Principal object in the cookie? I think that BinarySerializa tion, SOAPSerializati on or XMLSerializatio n won't be a good idea. The nature of cookie is to store a small piece of data. Or you have your own custom serialization method?

    I agree with what Frinny suggested: create your Identity and Principal objects in Global.asax. Yup, not to retrieve the objects from session, cookie or anywhere else, but to create...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...