Edmondo 0 Newbie Poster

Hello All

Does anyone know how to pass data from a textbox into a pre-defined outlook message?

I have some code I found which does a search for certain words in Microsoft Word documents and replaces them with the values from a textbox but when I try to convert this to work for Outlook I get a error.

Does anyone know of how I might complete this task?

Thanks

Edmondo 0 Newbie Poster

Since you want to open Outlook using asp.net, you can use JavaScript outlook to open Outlook at client PC. Try the following links. To pass data to outlook using javascript, you may use command line parameters when opening Outlook using javascirpt. Check the following links.

Opening Outlook through javascript
Sending Email From JavaScript using OutLook Automation
Command-line switches

Hello, thanks for the above, I have actually been programming in VB so was hoping there might be a way of getting it work using that?

Edmondo 0 Newbie Poster

Hi All

I have a problem where I want to open Outlook from a ASP button click which then pass data into the Outlook form from information that has been entered into textboxes by the user.

Could anyone point me in the direction of how I might go about passing textbox values into specific places in the Outlook form?

Thanks

Edmondo 0 Newbie Poster

Hello there, I'm again working with a insertTemplate but this time I would like to know, basically I have two SQL tables one called Technician and the other called Alert.

Basically I have a TextBox where a user can add new employees and save them to the Technician table, the Alert table then needs to have a lot of information entered along with the Technician name, this is automatically populated in a DropDownList from the Technician table.

When I enter all the information in and have the DropDownList populated with the Technician name data the DropDownList does not not save to the Alert database.

I assume this is becuase it is coming in from a different dataSource, is there a way around this so that I can still have the DropDownList populated from the employee table, but then get it to save up to the Alert one?

<td class="style20">
<asp:DropDownList ID="CreatorDownList" runat="server" AutoPostBack="True" 
Text='<%# Bind("Creator") %>' DataSourceID="TechnicianDataSource" 
DataTextField="TechnicianName" DataValueField="TechnicianName" 
                            onselectedindexchanged="CreatorDownList_SelectedIndexChanged">                      
</asp:DropDownList> <asp:SqlDataSource ID="TechnicianDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" 

SelectCommand="SELECT TechnicianName FROM Technician">
                         </asp:SqlDataSource><asp:SqlDataSource

Above is the code for the Technician table

<asp:SqlDataSource ID="sendDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" 
        InsertCommand="INSERT INTO Alerts (SitesAffected, BulletinType, TechnicianDealing, Description, DateTime, SendTo, TextSent, Creator) VALUES (@SitesAffected, @BulletinType, @TechnicianDealing, @Description, @DateTime, @SendTo, @TextSent, @Creator)" 
        SelectCommand="SELECT Alerts.* FROM Alerts">
        <InsertParameters>
            <asp:Parameter Name="SitesAffected" />
            <asp:Parameter Name="BulletinType" />
            <asp:Parameter Name="TechnicianDealing" />
            <asp:Parameter Name="Description" />
            <asp:Parameter Name="DateTime" />
            <asp:Parameter Name="SendTo" />
            <asp:Parameter Name="TextSent" />
            <asp:Parameter Name="Creator" />
         </InsertParameters>
    </asp:SqlDataSource>

And here is the code to save to the Alert …

Edmondo 0 Newbie Poster

Hi thanks for your reply again. Well declaring the CriticalBx works in that it allows you to complete the IF statement but it isnt linking this to the CriticalBx on the web page. It almost see it as two different objects.

None of the controls in the insertTemplate are recognised in the VB code, is there some setting I need to change to make the controls visible or something?

Thanks

Hi I have managed to work out how to sort it

Dim CriticalList As DropDownList =  TryCast(FormView1.FindControl("CriticalBx"), DropDownList)

        If CriticalList.Text = ("Manchester") Then

            CiritcalList.Text = ("Employee1")

        End If

I found a example online which helped me understand how to reference the controls in the template, so thank you for all your assistance.

Edmondo 0 Newbie Poster

Ok. Here's another thought.
Can you see all controls in the template while in design mode?
If so, what happens if you double-click the dropdown control?

You should be "transferred" to the codebehind-file and a method is created for the dropdown-control's SelectedIndexChanged event.
And thus recognized.

On the other hand, have you checked to see if the dropdown gets declared while inside the template?
If it's not. Just manually declare it yourself in the codebehind-file. Protected WithEvents CriticalBx As DropDownList

Hi thanks for your reply again. Well declaring the CriticalBx works in that it allows you to complete the IF statement but it isnt linking this to the CriticalBx on the web page. It almost see it as two different objects.

None of the controls in the insertTemplate are recognised in the VB code, is there some setting I need to change to make the controls visible or something?

Thanks

Edmondo 0 Newbie Poster

Hi I'm still not getting the CriticalBx being recognised in the Vb code, it keeps telling me I need to declare CriticalBx. It is very odd, its like the template is blocking it from being recognised.

Anymore thoughts would be appreciated

Edmondo 0 Newbie Poster

You might wanna have a look at the ClientID property.
ASP.NET adds the container ID to the ID of a control in the container but ClientID is always the ID you gave the control.

Sorry how do you mean? I have tried to reference the name of the template that all the controls are stored in if that is what you mean?

Other than that sorry I dont know what you mean :(

Edmondo 0 Newbie Poster

Hi, sorry still learning how to do things in asp.

Basically I have a form that I set up using the insert template in visual studio.

where the code looks like this

<InsertItemTemplate>
            &nbsp;<table class="style15">
                <tr>
                    <td class="style18">
                        SitesAffected:
                    </td>
                    <td class="style16">
                        Description:</td>
                </tr>
                <tr>
                    <td class="style19">
                        <asp:CheckBoxList ID="SitesCheckBoxList" runat="server" AutoPostBack="True" 
                            Text='<%# Bind("SitesAffected") %>'>
                          
                            <asp:ListItem>Manchester</asp:ListItem>
                            <asp:ListItem>Newcastle</asp:ListItem>
                                                        
                        </asp:CheckBoxList>
                    </td>
                    <td class="style17">
                        <asp:TextBox ID="DescriptionTextBox" runat="server" Height="146px" 
                            Text='<%# Bind("Description") %>' Width="239px" />
                    </td>
                </tr>
                <tr>
                    <td class="style20">
                        Creator:</td>
                    <td>
                        SendTo:</td>
                </tr>
                <tr>
                    <td class="style20">
                        <asp:TextBox ID="CreatorTextBox" runat="server" Text='<%# Bind("Creator") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="SendToTextBox" runat="server" Text='<%# Bind("SendTo") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="style20">
                        TechnicianDealing:</td>
                    <td>
                        BulletinType:</td>
                </tr>
                <tr>
                    <td class="style20">
                        <asp:TextBox ID="TechnicianDealingTextBox" runat="server" 
                            Text='<%# Bind("TechnicianDealing") %>' />
                    </td>
                    <td>
                                                 
                           <asp:DropDownList ID="CriticalBx" runat="server" AutoPostBack="True" 
                            Text='<%# Bind("BulletinType") %>' 
                               onselectedindexchanged="CheckBoxList1_SelectedIndexChanged">
                            <asp:ListItem>High</asp:ListItem>
                            <asp:ListItem>Critical</asp:ListItem>
                            <asp:ListItem>Change</asp:ListItem>
                           </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style20">
                        TextSent:
                    </td>
                    <td>
                        DateTime:</td>
                </tr>
                <tr>
                    <td class="style20">
                        <asp:CheckBoxList ID="TextSentCheckList" runat="server" AutoPostBack="True" 
                            Text='<%# Bind("TextSent") %>'>
                            <asp:ListItem>Yes</asp:ListItem>
                            <asp:ListItem>No</asp:ListItem>
                        </asp:CheckBoxList>
                    </td>
                    <td>
                        <asp:TextBox ID="DateTimeTextBox" runat="server" 
                            Text='<%# Bind("DateTime") %>' />
                    </td>
                </tr>
            </table>
            <br />
            <asp:Button ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Send" onclick="InsertButton_Click" />
            &nbsp;<asp:Button ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" 
                style="margin-bottom: 0px" />
        </InsertItemTemplate>

What I want to do is put in a IF statement for a drop down list where if a certain value is selected it does something.

However in the vb page it doesn't recognise the drop down list I have, however if I move the drop down list outside the template it does recognise it.

Does anyone know how I can …

Edmondo 0 Newbie Poster

Sknake is right!! Two separate insert statements is required

Hello! Have I not done two seperates ones as shown above?

Edmondo 0 Newbie Poster

Hi you can write two seperate insert queries on single button click... y r u opting for single query.. if u need that let me know.. please follow this..

INSERT INTO Names (person1, Address, Postcode)
VALUES (@person1, @Address, @Postcode) //this is first query

INSERT INTO Group (GroupName)
VALUES (@GroupName)
//this is second query...

just split your query...

Hello, thanks for reply

This is my code

<asp:SqlDataSource ID="AdminDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:itAlertsDatabaseConnectionString %>"
 
InsertCommand="INSERT INTO SMS_GroupRecipients (emailaddress, mobilenumber, Name) VALUES (@emailaddress, @mobilenumber, @Name) INSERT INTO SMS_GroupNames (GroupName) VALUES (@GroupName)" 
                                
ProviderName=<%$ConnectionStrings:itAlertsDatabaseConnectionString.ProviderName %>" 
                                
SelectCommand="SELECT SMS_GroupRecipients.*, SMS_GroupNames.* FROM SMS_GroupRecipients, SMS_GroupNames">
</asp:SqlDataSource>

But I'm still getting the error about the ";" sorry any thoughts?

Edmondo 0 Newbie Poster

Hello everyone, can you help?

I am trying to build a site using visual studio with a access database back end, basically two of the tables in the database are linked and I want to update the both of them at the same time.

What I have is a "Formview" data connection where three of the input boxes link to a "Names" table and one input box links to the "Group" table. I want to insert data into both tables on the same button click.

When I try though I can't seem to get this to work, I thought you could put a standard INSERT query in the code referencing the two tables as below

INSERT INTO Names (person1, Address, Postcode)
VALUES (@person1, @Address, @Postcode) AND
INSERT INTO Group (GroupName)
VALUES (@GroupName)

I keep getting a error about inserting a ";" at the end but tried that and nothing works.

Does anyone have any thoughts at all? Am I missing something obvious?

Thanks