Wednesday, September 26, 2018

Concat in SQL Query

Concat in SQL Query

SELECT (au_lname + ', ' + au_fname) AS Name
FROM authors
ORDER BY au_lname ASC, au_fname ASC
Here is the result set:
Name                                                           
-------------------------------------------------------------- 
Bennet, Abraham                                                
Blotchet-Halls, Reginald                                       
Carson, Cheryl                                                 
DeFrance, Michel                                               
del Castillo, Innes      

Script to Count text length in textbox


<script type="text/javascript">
    function ismaxlength(objTxtCtrl, nLength) {
        if (objTxtCtrl.getAttribute && objTxtCtrl.value.length > nLength)
            objTxtCtrl.value = objTxtCtrl.value.substring(0, nLength)

        if (document.all)
            document.getElementById('<%= lblCaption.ClientID %>').innerText = objTxtCtrl.value.length + ' daripada ' + nLength;
        else
            document.getElementById('<%= lblCaption.ClientID %>').textContent = objTxtCtrl.value.length + ' daripada ' + nLength;

    }
</script>


<asp:TextBox ID="txtNote" runat="server" Width="381px" Rows="3" onkeyup="return ismaxlength(this,250)"
                    TextMode="MultiLine"  ></asp:TextBox> <br />
<asp:Label runat="server" ID="lblCaption" Font-Bold="True" Visible="True">

Set Back Button


//back button
Button5.Attributes.Add("onClick", "javascript:history.back(); return false;");

//confirmation button
btnRemoveGroup.Attributes.Add("onclick", "javascript:return confirm('Pastikah anda ingin hapuskan maklumat tersebut ?')");


 //Hyperlink
  <asp:TemplateField HeaderText="Nama">
                  <ItemTemplate>
                   <asp:HyperLink HeaderText="Nama"  Target="_top" ID="HyperLink1" runat="server" Text='<%# Eval("Nama_Ahli") %>' NavigateUrl='<%# Eval("No_Ahli", "~/Report/MemberDetail.aspx?prm_ID={0}") %>'></asp:HyperLink>
                  </ItemTemplate>
                     <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                     <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
                </asp:TemplateField>