vuyiswamb 17 Posting Whiz

Your SQL Table Must have a Identity Column first change the Defination of your table to this

CREATE TABLE mytable
      (
      id INT IDENTITY(1,1) PRIMARY KEY not null,
      Fname text,
      Surname text,
      Tel text,
      Salary DECIMAL(18,2)
    );
vuyiswamb 17 Posting Whiz

No Problem and dont Forget to mark the post as resolved and give me my reputation. am going home now enjoy your weekend

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Here is your Solution

SqlConnection con =new SqlConnection(@"User id=sa;Password=oops;Server=VUYISWA\SQLEXPRESS;Database=Vuyiswa");
        
        SqlCommand cmdinsert = new SqlCommand();
        
        cmdinsert.CommandText=@"BULK INSERT mytable FROM 'C:\WebSite29\Data.txt' WITH (FIELDTERMINATOR = '|', ROWTERMINATOR = '\n' );";

        cmdinsert.CommandTimeout = 0;

        cmdinsert.CommandType= CommandType.Text;

        cmdinsert.Connection = con;

        try
        {
            con.Open();

            cmdinsert.ExecuteNonQuery();

        }
        catch(SqlException ex)
        {

            Label1.Text = ex.Message.ToString();
        }   
        finally
        {
            if(con != null)
            {
                con.Close();
            }
        }

Kind Regards

Vuyiswa

vuyiswamb 17 Posting Whiz

ok

vuyiswamb 17 Posting Whiz

Can you Post your TextFile and a Create Script of your SQl Table and i will give you an Exact code to write.

kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Remove the First Column and let SQl add it for you as an identity Column.

vuyiswamb 17 Posting Whiz

What is the Problem ?

vuyiswamb 17 Posting Whiz

Am glad you got your Solution . Mark your Post as Resolved

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Dont Worry about the REfreshing, add the Grid into an Update Panel to remove the Page Flickers

sandeep_1987 wrote :

hi vuyiswamb,first of all Thx for the Reply. I dont want that .To Add Record I want that first row in the Grdiview should always be a row that contains textboxes & other Controls.

mmh i see what you are Saying. It can be done ,but there another way that the Gridview do for you, at the End of each grid, if you click an insert Button on the grid, it adds a New empty place where you can add the Record. The checkboxes and the Dropdown will still persist.

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz
vuyiswamb 17 Posting Whiz

Most of the Paid domains give this for free in their Control Panels. or you can try this

protected void Page_Load(object sender, EventArgs e)
    {
        Application.Lock();
        if(Application["HitCount"]!=null)
         {
            Application["HitCount"]=(int)Application["HitCount"]+1;
         }
        else
         {
             Application["HitCount"] =1;
         }
         Application.UnLock();
        lblInfo.Text="The page has been accessed ("+Application["HitCount"].ToString()+") times";
    }

or this might Help

http://www.stardeveloper.com/articles/display.html?article=2002102501&page=1

Kind Regards

Vuyiswa Maseko

sknake commented: neat, i didn't know about that +17
vuyiswamb 17 Posting Whiz

Good Day sandeep_1987

sandeep_1987 wrote :

I want to develop a Phonebook application .Suppose initially as when the number of records in DB is zero,Den I want just to have one row in Gridview that contains textboxes & dropdown & in pic. Now suppose When the user add one record & click on add Button,Dat record is added in gridview & first row is same that contains textboxes & other controls.

You dont allows need agridview to add data into the Table, you can use a normal page with Textboxes and Validate whatever you want before you send the data to the Database, Consider that option.

sandeep_1987 wrote :

hey tell me ,if the number is of records are large then everytime if we bind the DB to Gridview,it takes times,There is no such procedure to add the records in Grdiview widout binding again.

if you add Paging in your Gridview the Records will not all be shown at the same time. Look at this article Regarding that

How to do Paging in a Gridview

sandeep_1987 wrote :

hi vuyiswamb,tell me one thing,suppose first time textboxes & dropdown controls are there in first row.Now suppose user add records.After one record is added,now that row wid textnoxes & dropdown controls will be there again in the Gridview.

I now see what you want Exactly. a Gridview will automatically create a Textbox to edit data if you want to edit data. Look at this two articles, …

vuyiswamb 17 Posting Whiz

sknake it seems as if they have done a pre-complilation and now he is trying to open those aspx page , but let us make sure.

Vampdee in the File that you have do you have a Solution file(.sln) and do you have a (.cs) or (.vb) files for each aspx page ?

Vampdee commented: .sln is what I was missing +0
vuyiswamb 17 Posting Whiz

Good Day

i want to help you , but i want to laugh at you on the statement you have made

Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.

The Version of .NET are not the same and Visual Studios are the same. Visual Studio 2003 was for 1.1 and if you try to open a Project of that kind in VS2008 , i can imagine the Problem you will encounter , the Gap between the Versions is huge. Can you determine what Version of .NET is your Project. because really you cant just open everything aspx file in anytime of version of VS you want.

vuyiswamb 17 Posting Whiz

You are Welcome. You can Mark the Thread as "Resolved" or Add Reputation"

Thank you

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Now this mean that the PC in other Network have no access to your private Network. So the Problem here is not your Application , the other PC's dont have access to your Private network.

Please Talk to your Network guys about this Issue. if they can ping it from outsite Network , then your problem will be solved

kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

ok,Are the Other PC in the Same Network as you are ?

Go to Control Panel --> Administrative Tools-->Internet Information Services

i have Attached a Document , please send me Screenshots as i requested in the document. another this is go to start first

Start--> Run

and Type

Cmd

and click ok

in the cmd type the following

Ping d3ric3-913b8755

and send me the Screenshot of the Results. Please note that you must do this on the other computers not your own. This will tell me if you can see your PC from other PC.

vuyiswamb 17 Posting Whiz

Now this means your URL will be

http://d3ric3-913b8755/fp/

Try it and check if it works

Kind Regards


Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Right Click on "My Computer" and to Go Properties --> ComputerName, in the Full Computer Name : Tell me what is there

vuyiswamb 17 Posting Whiz

Good Day Derice

The Url will be Formed like this

http://[Machinename]/[Virtual Directory]/

That will be the URL.

Hope this Helps

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

This is how you can do it

http://www.webcheatsheet.com/ASP/get_current_page_url.php

Kind Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

He is Right, You need to do in Management Studio and use a Create Script. Am not Sure you can do this programatically

vuyiswamb 17 Posting Whiz

use Template Fields like this

<asp:GridView ID="MYGRid" runat="server" AutoGenerateColumns="false">
    <Columns>
    <asp:TemplateField >
    <ItemTemplate>
     <asp:CheckBox ID="ID" runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText ="Name">
    <ItemTemplate>
    <asp:TextBox ID="textbox1" runat="server"></asp:TextBox>
    </ItemTemplate>
    </asp:TemplateField>
   
    <asp:TemplateField HeaderText ="Mobile Number">
    <ItemTemplate>
    <asp:TextBox ID="textbox2" runat="server"></asp:TextBox>
    </ItemTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText ="Age">
    <ItemTemplate>
    <asp:TextBox ID="textbox3" runat="server"></asp:TextBox>
    </ItemTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText ="Gender">
    <ItemTemplate>
    <asp:DropDownList ID="dropdown1" runat="server"></asp:DropDownList>
    </ItemTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText ="City">
    <ItemTemplate>
    <asp:TextBox ID="textbox4" runat="server"></asp:TextBox>
    </ItemTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText ="City">
    <ItemTemplate>
   <asp:Button ID="button1" Text="Add" runat="server" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    
    </asp:GridView>

on the Databound Event Bind the ComboBox to the Female and Male.

Hope this Helps

vuyiswamb 17 Posting Whiz

i think toady its the same as last few months again. i dont want to grow anymore

vuyiswamb 17 Posting Whiz

I find the Problem. it was not SQL. Thank you.

vuyiswamb 17 Posting Whiz

Good Day All

I have SQL 200 and a SQL 2008 in one Machine. At First there was SQL 2000 and i install SQL 2008. Now we have a ilog Application written in C++. am not sure what that developer uses to connect to the SQL. Now the Application can connect to SQL 2000 but not to SQL 2008.

I had a thought that the Default instance still points to SQL 2000

I dont know what is wrong

Thanks

vuyiswamb 17 Posting Whiz

I thought i understood what you wanted to do from the Beginning , can you please rephrase your question again.

vuyiswamb 17 Posting Whiz

:)

vuyiswamb 17 Posting Whiz

That is Simple remove the Connection string from your App and put in a web config and access it from there. see how i did it here

http://www.codeproject.com/KB/tips/StoringConstring.aspx

vuyiswamb 17 Posting Whiz

You what you want exactly is that you want to change the Connection-string without recompiling your application because the Connection string might change at anytime ?

vuyiswamb 17 Posting Whiz

So what you mean is that is you go to explorer and paste this

C:\\Users\\Craig\\Desktop\\Project\\App_Data\\

It shows you the Folder with ASPNETDB.MDF File ? please Confirm

vuyiswamb 17 Posting Whiz

If you want to be a good programmer one day, you need to read and practice and make research before you can ask someone. It seems that you did not even try , nor Google. the First thing you can do is to buy a book and read , this is a very basic question and it has been covered by almost all beginners book.

vuyiswamb 17 Posting Whiz

This is not Right

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True

Go to get the Path and show it to use and we will tell you how to fit in the connection string

vuyiswamb 17 Posting Whiz

Really my friend , you need to buy a Book and read. You cant learn everything on the internet. In some Forums they will delete your post. look at this articles

http://www.codeproject.com/KB/vb/N-Tier_Application_VB.aspx

http://www.codeproject.com/KB/tips/StoringConstring.aspx

http://www.codeproject.com/KB/cs/NTier.aspx

http://www.codeproject.com/KB/cs/N-Tier22.aspx

http://www.codeproject.com/KB/aspnet/Paging_without_a_Wizard.aspx

Regards

Vuyiswa Maseko

vuyiswamb 17 Posting Whiz

Well i think if you write you sql nicely and optimized, i don't think you will need a Data-reader. a Data-reader is known with its great performance. But if you have a little data to Display like drop-down , i will go for a data-table or data-set because the different will not matter in the performance , it might 0.01 percent and you will barely see it.

vuyiswamb 17 Posting Whiz

Good Day all

I have a Usercontrol that has a Gridview and its hosted on my aspx page and the aspx page is defined like this

<%@ Page Language="C#" MasterPageFile="~/SubjectMasterPage.master" AutoEventWireup="true" CodeFile="SubjectStruct.aspx.cs" Inherits="SubjectStruct" Title="o! WebEditor : Subject Structure" %>

<%@ Register Src="SubjectNote.ascx" TagName="SubjectNote" TagPrefix="uc4" %>

<%@ Register Src="SubjectDetails.ascx" TagName="SubjectDetails" TagPrefix="uc2" %>
<%@ Register Src="SubjectSelector.ascx" TagName="SubjectSelector" TagPrefix="uc3" %>

<%@ Register Src="ActivityCtrl.ascx" TagName="ActivityCtrl" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
      <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
        <tr>
            <td>
                <table align="left" border="0" cellpadding="2" cellspacing="0" width="100%">
                    <tr>
                        <td valign="top" align="left" style="width: 1%">
                            <uc3:SubjectSelector ID="SubjectSelector1" runat="server" />
                        </td>
                        <td valign="top" style="text-align: left; width: 1%;" align="center">
                <uc2:SubjectDetails ID="SubjectDetails1" runat="server" />
                        </td>
                        <td valign="top" style="text-align: left" align="right" width="40%">
                <uc4:SubjectNote ID="SubjectNote1" runat="server" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <table border="0" cellpadding="2" cellspacing="0" width="100%" align="left">
                    <tr>
                        <td height="96" style="border-top-width: 2px; border-left-width: 2px; border-left-color: #ffffff; border-bottom-width: 2px; border-bottom-color: #ffffff; border-top-color: #ffffff; border-right-width: 2px; border-right-color: #ffffff; width: 100%;" valign="top">
                <uc1:ActivityCtrl ID="ActivityCtrl1" runat="server" ActivityViewMode="Activity" KeepApart="false" OnLoad="ActivityCtrl1_Load1" TextBoxAutoPostBack="false" EnableViewState="true" />
                            <asp:SqlDataSource ID="SqlDataSourceActvDuration" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
                                SelectCommand="sp_Return_Actv_Durations" SelectCommandType="StoredProcedure">
                                <SelectParameters>
                                    <asp:SessionParameter Name="type" SessionField="TTBL_TYPE" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </td>
                        <td style="border-top-width: 2px; border-left-width: 2px; border-left-color: #ffffff; border-bottom-width: 2px; border-bottom-color: steelblue; border-top-color: #ffffff; border-right-width: 2px; border-right-color: #ffffff; text-align: center;" valign="top" width="400">
                            <asp:Panel ID="panelControls" runat="server" Height="100%" Width="100%" HorizontalAlign="Left" BorderStyle="None">
                                <table style="background-color: lightgrey; border-right: black 1px solid; padding-right: 0px; border-top: black 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 0px; border-left: black 1px solid; padding-top: 0px; border-bottom: black 1px solid;">
                                    <tr>
                                        <td style="background-image: url(Images/CD/monthView_header.jpg); background-repeat: repeat-x;
                                            text-align: center; border-top-style: none; border-right-style: none; …
vuyiswamb 17 Posting Whiz

Today was a long day.

Thank you it worked.

vuyiswamb 17 Posting Whiz

Good Day all

I have an SP that is defined like this

ALTER PROCEDURE [dbo].[sp_Constraints_Update] @xml ntext,
@TTBLType varchar(5)

AS

set nocount on

DECLARE @xmldoc int
DECLARE @sql varchar(8000)

-- In one long sql string do all of the following
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @xmldoc OUTPUT, @xml



if exists (select * from [tempdb].[dbo].sysobjects where id = object_id(N'[tempdb].[dbo].[#Constraints]'))
  drop table [#Constraints]

-- turn the xml into a table with characteristics of the given table
SELECT *
INTO #Constraints
FROM OPENXML ( @xmldoc , '/Root/Row' , 2)
WITH     (
        [ID] int,        -- ID of the activitiy or contact (XM) to update
        DayOp char(7) 'Day_Action',
        [Day] int 'Day',
        SessOp char(7) 'Period_Action',
        Sess int 'Period'
       
    )

EXEC sp_xml_removedocument @xmldoc

--select * from #Constraints

update #Constraints  set [Day] = null where [Day] = 0    -- can't have [Day] <, = or > 0
update #Constraints  set [Sess] = null where [Sess] = 0    -- can't have [Day] <, = or > 0

-- todo make this generic for class or exam
update tbl_actv
    set [Day] = #Constraints.[Day],
        DayOp = case(#Constraints.[DayOp])
                    when 'on' then '='
                    when 'before' then '<'
                    when 'after' then '>'
                end,
        Session = #Constraints.Sess,
        SessOp = case(#Constraints.[SessOp])
                    when 'on' then '='
                    when 'before' then '<'
                    when 'after' then '>'
                end
    from #Constraints
    where #Constraints.ID = tbl_actv.ID

and i have have tried to execute it like this

exec sp_Constraints_Update 'EXAM','<Root><Row><ID>3</ID><Activity>ACC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>15</Day><Period_Action>on</Period_Action><Period>15</Period></Row><Row><ID>9</ID><Activity>ADM121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>4</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>13</ID><Activity>ADM122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>7</Period></Row><Row><ID>50</ID><Activity>BEC122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>12</Day><Period_Action>on</Period_Action><Period>143</Period></Row><Row><ID>44</ID><Activity>BEC121 T1 [1]</Activity><Day_Action>on</Day_Action><Day>12</Day><Period_Action>on</Period_Action><Period>12</Period></Row><Row><ID>126</ID><Activity>MRK122 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>4</Period></Row><Row><ID>287</ID><Activity>ENGL321 T1 [1]</Activity><Day_Action>on</Day_Action><Day>1</Day><Period_Action>on</Period_Action><Period>21</Period></Row><Row><ID>288</ID><Activity>ENTR_E_221 T1 …
vuyiswamb 17 Posting Whiz

Thank you that was the Reason

vuyiswamb 17 Posting Whiz

Good Day all

I have a Sp that is written like this

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go




ALTER PROCEDURE [dbo].[Import_RegistrationsXM] @xml ntext

AS

set nocount on

DECLARE @doc int
EXEC sp_xml_preparedocument @doc OUTPUT, @xml  

TRUNCATE TABLE _RegistrationXM
INSERT INTO _RegistrationXM
SELECT * 
FROM OPENXML ( @doc , 'Import/Item' , 2) 
WITH (  
    Student varchar(32),
    SubjectCode varchar(32),
    Campus varchar(32),
    Repeat bit
)
EXEC sp_xml_removedocument @doc

truncate table _Duplicates

exec( 'sp_RegistrationsXM_Populate' )

select 'XM Registrations successfully imported!' [Result]

i have an XML File that is 3.21mb, when i this Sp with the XML i get the Following Error

Exception caught in: ExecuteStoredProc: Cannot insert duplicate key row in object 'dbo._RegistrationXM' with unique index '_RegistrationXM_index'. The statement has been terminated. [/pre]

in the table _RegistrationXM there are no Records and in the File there are no Duplicates too.

Thank you

vuyiswamb 17 Posting Whiz

Good Morning

it got Fired. But the Problem was that the statement

if(!page.ispostback)
{
}

was not always true that is why it gave a Problem. i resolved this by commenting it out.

Thanks

vuyiswamb 17 Posting Whiz

Good Day ALL

I have a UserControl that has a Dropdownlist. In the Hosting Page i have a Ultrawebgrid that gets updated based on the Selecteindexchange event the the dropdown. I have have another Control on the Left hand side that needs to be Updated on Selecteindexchange of the Drop down. Now the Left hand side Control Works and it gets updated but the Grid does not get updated. I have attached a link to photo of my design

[IMG]http://www.vuyiswamaseko.somee.com/GRid_Update.JPG[/IMG]

Here is a Definition of my Grid

<igtbl:UltraWebGrid ID="Gridstaff" runat="server" Height="158px" StyleSetName="RubberBlack"
                                                            Width="400px">
                                                            <Bands>
                                                                <igtbl:UltraGridBand>
                                                                    <AddNewRow View="NotSet" Visible="NotSet">
                                                                    </AddNewRow>
                                                                </igtbl:UltraGridBand>
                                                            </Bands>
                                                            <DisplayLayout BorderCollapseDefault="Separate" LoadOnDemand="Automatic" Name="ctl02xUltraWebGrid1"
                                                                RowHeightDefault="20px" SelectTypeRowDefault="Extended" Version="4.00">
                                                                <FrameStyle Height="158px" Width="400px">
                                                                </FrameStyle>
                                                                <ActivationObject BorderColor="" BorderWidth="">
                                                                </ActivationObject>
                                                            </DisplayLayout>
                                                        </igtbl:UltraWebGrid>

Thank you

vuyiswamb 17 Posting Whiz

Good Day

Thanks for your Reply. I have Trapped the Postback before i bind the GRid, without the Code the Grid got Binded mulitple times. i resolved it

Thanks

vuyiswamb 17 Posting Whiz

Good Day All

After Binding my Grid with 3 Columns , i found out that it Duplicates the Columns Twice. like this

Activity || Staff Member || Cycles  ||  Activity || Staff Member || Cycles || Activity || Staff Member || Cycles 

===============================================================================

C[1]       || DR  Vuyiswa      ||   Year ||               ||                          ||               ||             ||                          ||

All other Duplicated Columns have no Values

and the Grid is defined like this

<igtbl:UltraWebGrid ID="Gridstaff" runat="server" Width="344px" Height="111px" EnableAppStyling="False"
                                                                StyleSetName="RubberBlack" Autopostback="true" OnSelectedCellsChange="Gridstaff_SelectedCellsChange" OnSelectedColumnsChange="Gridstaff_SelectedColumnsChange" OnSelectedRowsChange="Gridstaff_SelectedRowsChange">
                                                                <Bands>
                                                                    <igtbl:UltraGridBand>
                                                                        <AddNewRow View="NotSet" Visible="NotSet">
                                                                        </AddNewRow>
                                                                    </igtbl:UltraGridBand>
                                                                </Bands>
                                                                <DisplayLayout AllowSortingDefault="OnClient" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti"
                                                                    Name="ctl172xGridstaff" RowHeightDefault="5px"
                                                                    SelectTypeRowDefault="Extended" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True"
                                                                    TableLayout="Fixed" Version="4.00" ViewType="OutlookGroupBy" ColWidthDefault="180px" EnableProgressIndicator="False" UseFixedHeaders="True">
                                                                    <FrameStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid"
                                                                        BorderWidth="1px" Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Height="111px"
                                                                        Width="344px">
                                                                    </FrameStyle>
                                                                    <Pager MinimumPagesForDisplay="2">
                                                                        <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                                                                            <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                                                        </PagerStyle>
                                                                    </Pager>
                                                                    <EditCellStyleDefault BorderStyle="Solid" BorderWidth="0px">
                                                                    </EditCellStyleDefault>
                                                                    <FooterStyleDefault BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                                                                        <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                                                    </FooterStyleDefault>
                                                                    <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid" HorizontalAlign="Left">
                                                                        <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                                                    </HeaderStyleDefault>
                                                                    <RowStyleDefault BackColor="Window" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
                                                                        Font-Names="Microsoft Sans Serif" Font-Size="8.25pt" Height="100%" HorizontalAlign="Left" TextOverflow="Ellipsis" Wrap="True">
                                                                        <BorderDetails ColorLeft="Window" ColorTop="Window" />
                                                                    </RowStyleDefault>
                                                                    <GroupByRowStyleDefault BackColor="Control" BorderColor="Window">
                                                                    </GroupByRowStyleDefault>
                                                                    <GroupByBox Hidden="True">
                                                                        <BoxStyle BackColor="ActiveBorder" BorderColor="Window">
                                                                        </BoxStyle>
                                                                    </GroupByBox>
                                                                    <AddNewBox>
                                                                        <BoxStyle BackColor="Window" BorderColor="InactiveCaption" BorderStyle="Solid" BorderWidth="1px">
                                                                            <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                                                        </BoxStyle>
                                                                    </AddNewBox>
                                                                    <ActivationObject BorderColor="" BorderWidth="">
                                                                    </ActivationObject>
                                                                    <FilterOptionsDefault>
                                                                        <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px"
                                                                            CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
                                                                            Font-Size="11px" Height="300px" Width="200px">
                                                                            <Padding Left="2px" />
                                                                        </FilterDropDownStyle>
                                                                        <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White">
                                                                        </FilterHighlightRowStyle>
                                                                        <FilterOperandDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid"
                                                                            BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif"
                                                                            Font-Size="11px">
                                                                            <Padding Left="2px" />
                                                                        </FilterOperandDropDownStyle>
                                                                    </FilterOptionsDefault>
                                                                    <SelectedRowStyleDefault BackColor="Gray">
                                                                    </SelectedRowStyleDefault>
                                                                    <FixedHeaderStyleDefault Height="100%">
                                                                        <Padding Bottom="2px" />
                                                                    </FixedHeaderStyleDefault>
                                                                </DisplayLayout>
                                                            </igtbl:UltraWebGrid>

Thank you

vuyiswamb 17 Posting Whiz

Good Morning All

i have a Ultrawebgrid defined like this

<igtbl:UltraWebGrid ID="ultraGridStudentsMixTypes" runat="server"
                                    Style="left: -8px; top: 375px" OnInitializeLayout="ultraGridStudentsMixTypes_InitializeLayout" OnDataBound="ultraGridStudentsMixTypes_DataBound" OnSelectedRowsChange="ultraGridStudentsMixTypes_SelectedRowsChange">
                                        <Bands>
                                            <igtbl:UltraGridBand>
                                                <RowEditTemplate>
                                                    <br />
                                                    <p align="center">
                                                        <input id="igtbl_reOkBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px"
                                                        type="button" value="OK" />&nbsp;
                                                        <input id="igtbl_reCancelBtn" onclick="igtbl_gRowEditButtonClick(event);" style="width: 50px"
                                                        type="button" value="Cancel" /></p>
                                                </RowEditTemplate>
                                                <RowTemplateStyle BackColor="Window" BorderColor="Window" BorderStyle="Ridge">
                                                    <BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px" WidthTop="3px" />
                                                </RowTemplateStyle>
                                                <AddNewRow View="NotSet" Visible="NotSet">
                                                </AddNewRow>
                                                <Columns>
                                                <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="ID" DataType="System.Int32"
                                                    Hidden="True" IsBound="True" Key="ID">
                                                    <Header Caption="ID">
                                                    </Header>
                                                </igtbl:UltraGridColumn>
                                                <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="Subject" IsBound="True" Key="Subject">
                                                    <Header Caption="Subject">
                                                        <RowLayoutColumnInfo OriginX="1" />
                                                    </Header>
                                                    <Footer>
                                                        <RowLayoutColumnInfo OriginX="1" />
                                                    </Footer>
                                                </igtbl:UltraGridColumn>
                                                <igtbl:UltraGridColumn AllowUpdate="No" BaseColumnName="Activity" IsBound="True"
                                                    Key="Activity">
                                                    <Header Caption="Activity">
                                                        <RowLayoutColumnInfo OriginX="2" />
                                                    </Header>
                                                    <Footer>
                                                        <RowLayoutColumnInfo OriginX="2" />
                                                    </Footer>
                                                </igtbl:UltraGridColumn>
                                                <igtbl:UltraGridColumn AllowUpdate="Yes" BaseColumnName="Length" DataType="System.Int32"
                                                    IsBound="True" Key="Length">
                                                    <Header Caption="Length">
                                                        <RowLayoutColumnInfo OriginX="3" />
                                                    </Header>
                                                    <Footer>
                                                        <RowLayoutColumnInfo OriginX="3" />
                                                    </Footer>
                                                </igtbl:UltraGridColumn>
                                                  <igtbl:UltraGridColumn AllowUpdate="Yes" BaseColumnName="Mix" DataType="System.Int32"
                                                    IsBound="True" Key="Mix">
                                                    <Header Caption="Mix">
                                                        <RowLayoutColumnInfo OriginX="4" />
                                                    </Header>
                                                    <Footer>
                                                        <RowLayoutColumnInfo OriginX="4" />
                                                    </Footer>
                                                </igtbl:UltraGridColumn>
                                            </Columns>
                                            </igtbl:UltraGridBand>
                                        </Bands>
                                        <DisplayLayout Version="4.00" AllowSortingDefault="OnClient" StationaryMargins="Header"
                                        AllowColSizingDefault="Free" StationaryMarginsOutlookGroupBy="True"
                                        HeaderClickActionDefault="SortSingle" Name="ultraGridStudentsMixTypes" BorderCollapseDefault="Separate"
                                        TableLayout="Fixed" RowHeightDefault="20px" SelectTypeRowDefault="Extended" CellClickActionDefault="RowSelect" EnableInternalRowsManagement="True" SelectTypeCellDefault="Extended" SelectTypeColDefault="Extended">
                                            <FrameStyle BorderWidth="1px" BorderColor="InactiveCaption" BorderStyle="Solid" Font-Size="10pt"
                                            Font-Names="Verdana" BackColor="Window">
                                            </FrameStyle>
                                            <Pager MinimumPagesForDisplay="2" PagerAppearance="Both" PageSize="30" StyleMode="ComboBox"
                                            AllowPaging="True" AllowCustomPaging="True">
                                                <PagerStyle BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray">
                                                    <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                                </PagerStyle>
                                            </Pager>
                                            <EditCellStyleDefault BorderWidth="0px" BorderStyle="None" Font-Names="Verdana" Font-Size="8pt">
                                            </EditCellStyleDefault>
                                            <FooterStyleDefault BorderWidth="1px" BorderStyle="Solid" BackColor="LightGray">
                                                <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                            </FooterStyleDefault>
                                            <HeaderStyleDefault HorizontalAlign="Left" BorderStyle="Solid" BackColor="LightGray"
                                            Font-Bold="True" Font-Names="Verdana" Font-Size="10pt">
                                                <BorderDetails ColorLeft="White" ColorTop="White" WidthLeft="1px" WidthTop="1px" />
                                            </HeaderStyleDefault>
                                            <RowStyleDefault BorderWidth="1px" BorderColor="Silver" BorderStyle="Solid" Font-Size="8pt"
                                            Font-Names="Verdana" BackColor="Window">
                                                <Padding Left="3px" />
                                                <BorderDetails ColorLeft="Window" ColorTop="Window" />
                                            </RowStyleDefault>
                                            <GroupByRowStyleDefault BorderColor="Window" BackColor="Control">
                                            </GroupByRowStyleDefault>
                                            <SelectedRowStyleDefault BackColor="Silver" Font-Names="Verdana" Font-Size="8pt">
                                            </SelectedRowStyleDefault>
                                            <GroupByBox>
                                                <BoxStyle BorderColor="Window" BackColor="ActiveBorder">
                                                </BoxStyle>
                                            </GroupByBox>
                                            <AddNewBox> …
vuyiswamb 17 Posting Whiz

It Did not work, but i Find the Code that works for gmail that looks like this

protected void Button1_Click(object sender, EventArgs e)
    {
        MailMessage mm = new MailMessage();

        SmtpClient smtp = new SmtpClient();

        mm.From = new MailAddress("Vuyiswa@its.co.za");

        mm.To.Add(new MailAddress("Dan@Gmail.com"));

        mm.To.Add(new MailAddress("Faj@CESC.co.za"));

        mm.Subject = "Hello";

        mm.Body = "<p>This is the E-mail Test for !Booking System</p>";

        mm.IsBodyHtml = true;

        smtp.Host = "smtp.gmail.com";

        smtp.EnableSsl = true;

        System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();

        NetworkCred.UserName = "vuyiswamb@gmail.com";

        NetworkCred.Password = "secret";

        smtp.UseDefaultCredentials = true;

        smtp.Credentials = NetworkCred;

        smtp.Port = 587;

        smtp.Send(mm);
    }
}

and it work ,but in my smtp it does not work, i need to talk to my Server Administrator

Thanks

vuyiswamb 17 Posting Whiz

Thank you very much

That worked like a Charm.

Tell me what is the Difference between this

strBody.Replace("(Username)",Username);
   strBody.Replace("(Password)",Password);

and your code that works like charm

strBody = strBody.Replace("(Username)", Username).Replace("(Password)", Password);

Thanks

vuyiswamb 17 Posting Whiz

Good Evening All

Am amazed that i cant use the Replace Function , its Probably the long that i had.

i have the Following code

String Username = "Vuyiswa";

            String Password = "secret";

            String strBody = @"<p>Thank you for using !obooking System <br><br> Username:(Username)<br><br>Password:(Password)<br<br>Kind Regards !oBooking</p>";

            strBody  = Regex.Replace(strBody,Username,"(Username)");

            strBody = Regex.Replace(strBody, Password, "(Password)");

            Response.Write(strBody);

i have tried the Normal replace Function, but the Variables are not returned with the Variables values.

Thanks

vuyiswamb 17 Posting Whiz

I forget to Add the To and when i Add the To i get a new Error

Thanks a lot for reminding me that part. i have added it and i get a new Error

System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: Microsoft Exchange Server 2003 POP3 server version 6.5.7638.1 (Mailserver.its.local) ready. at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.SendEmail(String from, String to, String cc, Int32 port, String subject, String message, String Host) in c:\Vuyiswa\Email_test\Default.aspx.cs:line 53

Thanks

vuyiswamb 17 Posting Whiz

Good Morning All

I have the Following code that sends an e-mail, let me first post the markup and the code behind. The following is the markup of my page

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        To &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<asp:TextBox ID="txtto" runat="server" Width="325px"></asp:TextBox><br />
        <br />
        From &nbsp;&nbsp; &nbsp;<asp:TextBox ID="txtFrom" runat="server" Width="326px"></asp:TextBox><br />
        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <br />
        CC: &nbsp; &nbsp;&nbsp; &nbsp;<asp:TextBox ID="txtcc" runat="server" Width="326px"></asp:TextBox><br />
        <br />
        Subject:
        <asp:TextBox ID="txtsubject" runat="server" Width="326px"></asp:TextBox><br />
        Body :<br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;
        <asp:TextBox ID="txtbody" runat="server" Height="86px" Width="314px"></asp:TextBox><br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
        Port: &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:TextBox ID="txtport" runat="server" Width="127px"></asp:TextBox><br />
        &nbsp;<br />
        Host &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:TextBox ID="txthost" runat="server" Width="127px"></asp:TextBox><br />
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<asp:Button ID="btnSend" runat="server"
            OnClick="btnSend_Click" Text="Send" />
        <asp:Button ID="btnCancel" runat="server" Text="Cancel" /><br />
        <br />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div>
    </form>
</body>
</html>

and i have a Function that sends the e-mail like this

private static string SendEmail(String from, string to, string cc,int port, string subject, string message,String Host)
    {
        //create the mail message
        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
        //set the content
        mail.From = new System.Net.Mail.MailAddress(from,"Test E-mail");

        mail.Subject = subject;

        mail.Body = message;
        
        mail.IsBodyHtml = false;
        
        
        //send the message
        //SmtpClient smtp = new SmtpClient("196.35.193.28");     // use this Smtp Server
        // seems we can use either the big …