ChimpusDupus 0 Light Poster

One of the pages in my web application works fine when I start the application from that page, but has some problems if I start from another page, including the Default.aspx page. When I went to investigate the problem, I realized that, if I start the application on the Default page and navigate to the page in question, none of the events get fired--no page_load, no prerender, no databound on my dropdown controls, nothing, not even if I refresh the page...

AutoEventWireup is true--I checked that :)

(Edit:) I think it is actually hitting the events, but just not hitting my breakpoints, which is still an issue

ChimpusDupus 0 Light Poster

Is there any easy (as in programmatic) way to make sure that every theme in the ASP.NET App_Themes folder for an application has skin definitions for all of the same controls.
For example, if an application has 3 themes and a new user control was added to a page, is there a way to programmatically ensure that all three themes have a definition for theming the new control. Or if a definition is added to Theme 1, have it add it to Theme 2 and 3 also?

ChimpusDupus 0 Light Poster

What code are you using to set the culture programaticaly?

ChimpusDupus 0 Light Poster

Hi,

I have a small website that I'm using to test some things involving accessing an XML file for data. It works just fine in Visual Studio's debugging environment, but when I put it on a prototype server (which has a certificate that is past it's expiration date). I get an authentication exception: The remote certificate is invalid according to the validation procedure.

I have no problem actually accessing the page, because I have the option to ignore the fact that the certificate is invalid, but when the application tries to access the XML file I have in the same directory, I get this exception. I've seen all kinds of tricks on the internet that are supposed to work around this but none of them seem to work.

any suggestions?

BTW, I'm using ASP.NET 3.5

ChimpusDupus 0 Light Poster

The reason that solution would not work for me is that theme must be set based on user preferences stored in some sort of datasource, right now an XML file, and thus would have to be set programmatically (rather than through the web.config file).

The solution I found does the trick. It's code to be placed in the global.asax file, which is exactly where i wanted it to be:

void Application_PreRequestHandlerExecute(object sender, EventArgs e)

    {

        Page page = Context.Handler as Page;
        String theme = "MyTheme";
        if (page != null)

        {

            page.Theme = theme;

        }

    }

where the theme variable is set to the value retrieved from the XML file

ChimpusDupus 0 Light Poster

Hi,

I have several themes that can be applied to pages on a website based on a users preferences. The problem is that the only way I know how to apply a theme to a website is to set the Page.Theme object in the page's PreInit event. This requires that code be placed on each and every page's PreInit event.

Is there any way to apply a theme globally (as in to all pages in a website) in just one location, such as a master page or the global.asax?

ChimpusDupus 0 Light Poster

Figured it out myself >_<
I just needed a Response.Redirect(); to redirect the browser to the same page

ChimpusDupus 0 Light Poster

Hi,

I have a drop-down list that is used to select a theme (which can only be set in the Page_PreInit event) and so I set a session object called theme that I use to set the theme in the PreInit event. The problem is that on the postback, the PreInit event occurs before the drop-down list is even created and thus before the list's SelectedIndexChanged event that I'm using to set the Session variable. The only thing I can think of doing is somehow doing a second postback so that the page loads again with the new theme setting. A call for this second postback would be in the SelectedIndexChanged event, but I don't know how to refresh the page like that using code.

So basically, how do you refresh/postback the page in code?

ChimpusDupus 0 Light Poster

hi,

I feel retarded working with XML right now because I have no clue whatsoever how to do anything with.

I really just need a simple, straigtforward description of how to read, edit, and write XML files that hold data, everything I've found on the internet and such hasn't given me what I need.

What I need it for is a project where I have a simple XML file (below) and I need to read data from the Theme element for the User element whose name matches a given name, which I can do, but I also want to be able to change that data and add entries.

Here's my XML File:

<?xml version="1.0" encoding="utf-8" ?> 
- <Users>
- <User Name="User 1">
  <Theme>Fire</Theme> 
  </User>
- <User Name="User 2">
  <Theme>Fire</Theme> 
  </User>
- <User Name="User 3">
  <Theme>Water</Theme> 
  </User>
- <User Name="User 4">
  <Theme>Fire</Theme> 
  </User>
- <User Name="">
  <Theme>Water</Theme> 
  </User>
  </Users>
ChimpusDupus 0 Light Poster

Looks like I found the answer somewhere else. I just had to use LEFT JOIN to the peerReviewQuality table for each column in the peerReview table:

SELECT peerReview.employeeID, Qplanning.qualityDescription, Qdecision.qualityDescription, QtimeManage.qualityDescription, Qproblem.qualityDescription, Qtechnical.qualityDescription, Qflexibility.qualityDescription, Qmotivation.qualityDescription, Qreliability.qualityDescription, Qteamwork.qualityDescription, QwrittenComm.qualityDescription, QoralComm.qualityDescription, QresultsContributes.qualityDescription, peerReview.comments, peerReview.timeDate FROM peerReview
LEFTJOIN peerReviewQuality AS Qplanning ON peerReview.planning = Qplanning.qualityID
LEFTJOIN peerReviewQuality AS Qdecision ON peerReview.decision = Qdecision.qualityID
LEFTJOIN peerReviewQuality AS QtimeManage ON peerReview.timeManage = QtimeManage.qualityID
LEFTJOIN peerReviewQuality AS Qproblem ON peerReview.problem = Qproblem.qualityID
LEFTJOIN peerReviewQuality AS Qtechnical ON peerReview.technical = Qtechnical.qualityID
LEFTJOIN peerReviewQuality AS Qflexibility ON peerReview.flexibility = Qflexibility.qualityID
LEFTJOIN peerReviewQuality AS Qmotivation ON peerReview.motivation = Qmotivation.qualityID
LEFTJOIN peerReviewQuality AS Qreliability ON peerReview.reliability = Qreliability.qualityID
LEFTJOIN peerReviewQuality AS Qteamwork ON peerReview.teamwork = Qteamwork.qualityID
LEFTJOIN peerReviewQuality AS QwrittenComm ON peerReview.writtenComm = QwrittenComm.qualityID
LEFTJOIN peerReviewQuality AS QoralComm ON peerReview.oralComm = QoralComm.qualityID
LEFTJOIN peerReviewQuality AS QresultsContributes ON peerReview.resultsContributes = QresultsContributes.qualityID
ChimpusDupus 0 Light Poster

Attatched is the diagram of the relationship. I want to display a report that has a qualityDescription for each of the columns in the peerReview table that are related to the peerReviewQuality table (planning, decision, timeManage, problem, etc.)

ChimpusDupus 0 Light Poster

Hm, I think my first message was probably very unclear. My problem seems to be that I'm working with a one-to-many relationship (I only know how to work with one-to-one relationships).

Basically, how do I write a SELECT command for two tables with a one-to-many relationship.

ChimpusDupus 0 Light Poster

Hi,

I created to data tables to hold information provided through peer reviews in the company that I work for. One table has 5 different levels of quality (unsatisfactory, meets some requirements, meets requirements, exceeds expectations greatly exceeds expectations), and another table that holds the data for each peer review (the person who is being reviewed, the time, comments, and a number to be used as a key into the quality table for each criteria). For example, one row might read: userID = 1, Planning=5 (greatly exceeds expectations), Decision Making = 3, Time Management =2, Comments = 'So-and-so has problems with...', time/date =June 20, 2007, 10:18.
The problem is, because there are numerous criteria for each peer review, I cannot figure out how to select a quality for each criteria.
If I do an INNER JOIN ON planning = qualityID and decisionMaking = qualityID... I don't get any data.

ChimpusDupus 0 Light Poster

Hi,

Is it possible to use the System.Drawing.Graphics methods without having to put code in the control's Paint event? If so, how?

-James

ChimpusDupus 0 Light Poster

Thanks for the link. It looks pretty helpful.

ChimpusDupus 0 Light Poster

I am planning to do the project alone and, though this may change later, I really only need it to work on my own computer, using Windows XP. I don't know C# very well, though I know it's basically C++ syntax with VB keywords. Hopefully I can pick up a cheap book on C# for the project. If absolutely necessary, could I use VB.NET with reasonable success?

ChimpusDupus 0 Light Poster

Hi,

I want to create a music editing program that will allow you to play songs using a MIDI device. I know there are significant differences in the capabilities of VB.NET and C++ but I'm not sure which would be more suited for such a project.

Any suggestions?

-James

ChimpusDupus 0 Light Poster

Image data is stored on a SQL database as binary data, and must be read as such. In order to create this DataGrid, you will need the page that it is on, say Default.aspx and another page to gather and display the image, say IMG.aspx. First look at IMG.aspx:

We need to read the binary data and output it within the page. We also need something to tell us what the id of the picture is in our database table. For this we will create a query in our URL. So the url of each image will be .../IMG.aspx?ID=XX, XX being the images ID. Then, in the code for that page, we gather the query value using Dim ImageID As Integer = Request.QueryString("ID") Then you need to set up a SQL Connection, Command, and DataReader, read the binary data and then write it to the page:

Dim iConn As New Data.SqlClient.SqlConnection("-Connection String Here-")
    Dim iCmd As New Data.SqlClient.SqlCommand("SELECT image FROM IMAGES WHERE image_id = " & ImageID, iConn)
    Dim iRead As Data.SqlClient.SqlDataReader

    iConn.Open()
    iRead = iCmd.ExecuteReader()
    Response.BinaryWrite(iRead("image"))
    iConn.Close()

Then, on Default.aspx, you add the datagrid and, instead of reading the binary data for the image from the database, you read the images ID, and add that to the url for the IMG.aspx page, which you then databind to an image or imagebutton's imageurl property.

ChimpusDupus 0 Light Poster

Yeah, I got that pretty easily. I just couldn't think of out to select record for all of the selected values each time the grid was databound. I ended up using a similar loop structure and then added " OR item_type_id = X " on each iteration in which the item was selected. Thanks anyway

ChimpusDupus 0 Light Poster

Hi,

Is it possible/how can I dynamically add fields to a DetailsView using code? I have a detailsview set for inserting data, but some of the fields that need to be inputed are based on records in the database, selected by a dropdown list in another field.


-James

ChimpusDupus 0 Light Poster

Hi,

I'm using a GridView Control in which I wish to show thumbnail versions of images saved as binary data on a SQL DB. I have a page that accepts an ID parameter to use in finding the image on the database. The page uses the Response.BinaryWrite() method to display the image which is used by the other page with the GridView. I've been simply using the URL to the image loading page for an ImageButton Control that is set to a certain width, thus making the image thumbnail sized while the page loads. Is it possible to resize the image before it is loaded into the ImageButton, possibly saving some time while the page loads?

-James Waltz

ChimpusDupus 0 Light Poster

Hi,

What is the best way to control data displayed by a GridView when using a listbox that allows you to make multiple selections. I'm currently using a Select Parameter to control the data displayed (using the WHERE clause of the SQL Select Query), though the FilterParameter would make more sense (if I could figure out how to use it). The select parameter is set to the SelectedValue property of the ListBox, but when multiple selections are made, only one SelectedValue is available through the property (the one with the lowest index, I think), thus showing only on of the selected groups in the GridView.

This is the portion of the page that is important:

<asp:ListBox ID="lstTypes" runat="server" Rows="5" SelectionMode="Multiple" DataSourceID="SqlItemTypes" DataTextField="item_type_name" DataValueField="item_type_id"></asp:ListBox> 
<asp:SqlDataSource ID="SqlItemTypes" runat="server" ConnectionString="<%$ ConnectionStrings:sysObjDBConnectionString %>"
SelectCommand="SELECT [item_type_name], [item_type_id] FROM [ITEM_TYPE_REF]"></asp:SqlDataSource>
<asp:GridView ID="grdItemInventory" runat="server" AutoGenerateColumns="False" DataKeyNames="item_id"
DataSourceID="SqlItemInventory">
<Columns>
<asp:BoundField DataField="item_id" HeaderText="item_id" InsertVisible="False" ReadOnly="True"
SortExpression="item_id" />
<asp:BoundField DataField="CheckedOut" HeaderText="CheckedOut" ReadOnly="True" SortExpression="CheckedOut" />
<asp:BoundField DataField="item_type_name" HeaderText="item_type_name" SortExpression="item_type_name" />
<asp:BoundField DataField="item_name" HeaderText="item_name" SortExpression="item_name" />
<asp:BoundField DataField="Status" HeaderText="Status" ReadOnly="True" SortExpression="Status" />
<asp:BoundField DataField="Responsible" HeaderText="Responsible" ReadOnly="True"
SortExpression="Responsible" />
<asp:BoundField DataField="item_inv_no" HeaderText="item_inv_no" SortExpression="item_inv_no" />
<asp:BoundField DataField="CheckedOutBy" HeaderText="CheckedOutBy" ReadOnly="True"
SortExpression="CheckedOutBy" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlItemInventory" runat="server" ConnectionString="<%$ ConnectionStrings:sysObjDBConnectionString %>"
SelectCommand="select i.item_id /*1*/, (CASE WHEN EXISTS(SELECT * FROM ITEM_CHECKOUT AS c WHERE c.item_id = i.item_id AND c.item_checkin_dt IS NULL) THEN 1 ELSE 0 END) AS CheckedOut /*2*/, tr.item_type_name /*3*/, i.item_name /*4*/, (SELECT sr.item_status_ref_name FROM ITEM_STATUS_REF AS sr WHERE sr.item_status_ref_id = (SELECT s.item_status_ref_id FROM ITEM_STATUS AS s WHERE s.item_status_dt = (SELECT MAX(item_status_dt) FROM ITEM_STATUS …
ChimpusDupus 0 Light Poster

I have a GridView and a DetailsView on the same page which work together allowing you to Insert or Edit data records read by the GridView from the DetailsView. My ASP.NET book explains how to do this...assuming you aren't using any template rows. I happen to be using several template rows that contain data to be sent to the database. How can I set a particular control to a particular SQLDataSource parameter for Inserting/Updating.

ChimpusDupus 0 Light Poster

Ummm...I'm know it seems like it should be obvious, but what does this mean:

Type 'System.Web.UI.WebControls.DataKey' in Assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

ChimpusDupus 0 Light Poster

Hi,

I have a controls in the footer row of a gridview that allow the user to insert a record into the data table bound to the gridview. The controls were each added into the columns by converting the columns to Template Columns and simply dragging and dropping the controls in. The problem is that I can not obtain the values from those controls during run time for use in the SQL command that adds the data record. Is there a way to get these values from within the GridView, or is it maybe possible to make the controls visible to the code from the outside of the DataGrid, such as a public variable?

ChimpusDupus 0 Light Poster

I think you can do this in the same way that you would any table-related collection. If you simply want to add a control, you user GridView1.Rows(y).Cells(x).Controls.Add(ControlToAdd) If you want to add a complete row of controls, you can create a table row object at runtime: Dim x as new TableRow and similarly create table cells. Then you will add each table cell to the row: TR.Cells.Add(TC) (TR = table row/TC = table cell). Finally, you would add the row to the gridview. GridView1.Rows.Add(TR) ...assuming you are using VB for coding ;)

ChimpusDupus 0 Light Poster

Thanks, that's just what I needed.

ChimpusDupus 0 Light Poster

Also, I can not figure out how to add a confirm option for the delete function, such as setting the delete button's onclient click property to a javascript confirm message's return value. (assuming of course the button has an onclientclick property)

ChimpusDupus 0 Light Poster

Hi,

I have a GridView that displays data from a MS SQL database (duh!). I know the GridView allows you to have a command column with such functions as Edit, Update, Delete, etc., which I wish to use. The problem is that I only want these functions to be available to the user that is responsible for the particular data item. How could I go about doing that? The current user is stored as user.Identity.name and will be compared against an ID returned from the database for each item.

ChimpusDupus 0 Light Poster

I tried setting the onClientClick property to if (confirm('Are you sure you want to delete this item?')){form1.submit;} but the result is still the same.

ChimpusDupus 0 Light Poster

I'm having the same problem with image buttons. The above solution works when done in something like the page_load, but in my case, the assignment of the even handler occurs in the button_click event of a pre-existing button, causing the same problem.

ChimpusDupus 0 Light Poster

If you haven't guessed by the number of questions I'm asking, I'm in the process of learning ASP.NET as well as using it to update a website.

This problem deals with Validation. Basically, I have two buttons within a table that have the functions of Editing corresponding data in the table and Deleting the corresponding data. When each (image)button is pressed, the appropriate even should occur, per the event handlers added to each control upon creation (showAnnouncements() sub). This works alright except I must click each button twice. On the first click, the page performs a postback and the validation controls for a separate function are activated. Then on the second click, it performs correctly. I have set the validation controls, the validation summary, and the controls that are validated by this separate function to a separate validation group and I have set these imagebuttons' CausesValidation property to false, which should prevent the firing of Validation controls. Why is this occuring, and how can I fix it?

My code is below:

page.aspx

<%@ Page Language="VB" MasterPageFile="~/lib/Normal.master" 
AutoEventWireup="false" CodeFile="mng_announcement.aspx.vb" 
Inherits="maint_mng_announcement" title="Announcement - Zekiah Technologies Intranet" 
ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Body" Runat="Server">
      <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0" 
>
        <asp:View ID="NormalView" runat="server">
                    <br />
            <asp:Table ID="tblAnnouncementsOuter" runat="server" 
CellSpacing="0" BorderColor="black" Borderwidth="1" Width="75%" 
cellPadding="2">
                <asp:TableHeaderRow BackColor="gray" ForeColor="white">
                    <asp:TableCell Width="5%" HorizontalAlign="center">
                        &nbsp;
                    </asp:TableCell>
                    <asp:TableCell Width="15%" HorizontalAlign="left">
                        TITLE
                    </asp:TableCell>
                    <asp:TableCell Width="60%" HorizontalAlign="left">
                        ANNOUNCEMENT
                    </asp:TableCell>
                    <asp:TableCell Width="15%" 
HorizontalAlign="center">
                        DATE
                    </asp:TableCell>
                    <asp:TableCell Width="5%" HorizontalAlign="center">
                        ACTIVE
                    </asp:TableCell>
                </asp:TableHeaderRow>
                <asp:TableRow>
                    <asp:TableCell ColumnSpan="5">
                        <asp:Label ID="lblNoAnnouncements" 
runat="server" Text="Sorry, there are no …
ChimpusDupus 0 Light Poster

Hi,

I'm creating a page that has an ASP button that should delete a row of data from an SQL database. I want a javascript confirm window to appear to make sure the user really wants to delete the information. I can set the button's OnClientClick property to "javascript:confirm('Are you sure you want to delete this item?')", but the server-side event, Button_Command, still occurs regardless of whether yes or no is chosen in the confirm window. How can I fix this?

-James

ChimpusDupus 0 Light Poster

Not sure if it will work but try changing onClick in the input button's tag to onServerClick. If that doesn't work, give the button an ID and then add a handles ButtonID.ServerClick to the function declaration.

ChimpusDupus 0 Light Poster

Okay, I've broken this down to make the problem as clear as I can. Here is the code I have written for a simple page with one table called Table1(with one row and one cell), and a Button called Button1

Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Sub imgClick(ByVal sender As Object, ByVal e As ImageClickEventArgs)
Response.Write("Image Click")
End Sub
Sub imgCommand(ByVal sender As Object, ByVal e As CommandEventArgs)
Response.Write("Image Command")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim img As New ImageButton
img.ImageUrl = "~/t_can.gif"
AddHandler img.Click, AddressOf Me.imgClick
AddHandler img.Command, AddressOf Me.imgCommand
Table1.Rows(0).Cells(0).Controls.Add(img)
End Sub
End Class

The lines AddHandler img.Click, AddressOf Me.imgClick and AddHandler img.Command, AddressOf Me.imgCommand add the events for the image button. When this code is done to an image button that is either already on the form, or is generated during the Form_Load event, this works correctly and the actions in the imgClick and imgCommand subs are executed when the image is clicked; however, if the button is generated by another event such as a button's click event, this does not work. Why does this happen and how might I be able to fix it?

ChimpusDupus 0 Light Poster

Looks like I cannot get the imagebutton's _click event to happen either :sad:

ChimpusDupus 0 Light Poster

Anyone?

ChimpusDupus 0 Light Poster

Just now figured it out after about 2 days of trying things. The problem was caused by the fact that I was programmatically 'moving' the lists into a table. When that happens, I think the control is being copied, minus the selected values. It works perfectly if the list is already inside its containing control, in this case the table.

ChimpusDupus 0 Light Poster

Looks like I'm having the same problem on another page with another list-related control. It seems that lists do not want retain their selected value information on for postbacks (unless they initiate the postback). It might have something to do with the fact that the controls are being binded to data each time the page is loaded; however, when I tried to keep it from doing this, the control still did not retain the pertinent information. -_-

ChimpusDupus 0 Light Poster

I did try to add the IsPostBack check again, and it seems to conserve the DropDownList values, but not the selected information (.selectedvalue, .selectedtext, and .selectedindex). As far as my code, happy reading ;) :

.aspx page

<%@ Page Language="VB" MasterPageFile="~/lib/Normal.master" AutoEventWireup="false" CodeFile="reflinks.aspx.vb" Inherits="resources_reflinks" title="Reference Links - Zekiah Technologies Intranet" EnableViewState="true"%>
<asp:ContentID="Content1"ContentPlaceHolderID="Body"Runat="Server">
 
<asp:Table ID="tblLinks" runat="server" Width="99.5%" CellSpacing="0" BorderWidth="1" BorderColor="Black" BorderStyle="Solid">
<asp:TableHeaderRow BackColor="gray" ForeColor="white">
<asp:TableCell columnspan="6">
:: REFERENCE LINKS ::
</asp:TableCell>
</asp:TableHeaderRow>

<asp:Tablerow>
<asp:TableCell ColumnSpan="6">
&nbsp; <asp:Label ID="lblAddMessage" runat="server" Text="Label" ForeColor="red" Font-Bold="true" Visible="false"></asp:Label>
</asp:TableCell>
</asp:Tablerow>

<asp:TableRow>
<asp:TableCell HorizontalAlign="center" Width="50%" ColumnSpan="6">
Select a Topic:
<asp:DropDownList ID="TopicDrop" runat="server" DataSourceID="SqlDataSource1" DataTextField="ref_topic_name" DataValueField="ref_topic_id" AutoPostBack="True" AppendDataBoundItems="true">
<asp:ListItem Value="0" Selected="true" Text="- All Topics -" />
</asp:DropDownList>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow BackColor="gray" ForeColor="white">
<asp:TableCell Width="10%">
&nbsp; 
</asp:TableCell>
<asp:TableCell HorizontalAlign="left" Width="10%">
TOPIC
</asp:TableCell>
<asp:TableCell HorizontalAlign="left" Width="40%">
LINK
</asp:TableCell>
<asp:TableCell HorizontalAlign="left" Width="20%">
DESCRIPTION
</asp:TableCell>
<asp:TableCell HorizontalAlign="left" Width="10%">
DATE
</asp:TableCell>
<asp:TableCell HorizontalAlign="left" Width="10%">
USER
</asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="6">
<asp:Label ID="lblNoLink" runat="server" Text="Label" ForeColor='Red' Font-Bold="true" Visible="false">There are no FAQs for your selected topic!</asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<input id="btnAdd" type="button" value="Add" runat="server" class="btnSubmitType" onmouseover="this.className = 'btnSubmitHov'" onmouseout="this.className='btnSubmitType'" validationgroup="AddLink"/>
<asp:DropDownList ID="TopicDrop2" runat="server" DataTextField="ref_topic_name"
DataValueField="ref_topic_id" AppendDataBoundItems="true" ValidationGroup="AddLink">
<asp:ListItem Value="0" Selected="True" Text="- Topic -" />
</asp:DropDownList>
<asp:TextBox ID="txtLink" runat="server" ValidationGroup="AddLink"></asp:TextBox>
<asp:TextBox ID="txtDescription" runat="server" ValidationGroup="AddLink"></asp:TextBox>&nbsp;
<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:sysObjDBConnectionString %>"
SelectCommand="SELECT * FROM REFERENCE_TOPIC ORDER BY ref_topic_name">
</asp:SqlDataSource>
 
</asp:Content>

.aspx.vb

PartialClass resources_reflinks
Inherits System.Web.UI.Page
Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
If Not IsPostBack Then
TopicDrop2.DataSource = SqlDataSource1
TopicDrop2.DataBind()
ShowLinks(0)
End If
End Sub
 
Sub ShowLinks(ByVal Topic As Integer)
Dim Conn …
ChimpusDupus 0 Light Poster

I just checked and everything related to that DropDownList has the viewstate enabled.

ChimpusDupus 0 Light Poster

Hi,

I am creating a page in which thumnails, in the form of Image Buttons (System.Web.UI.WebControls.ImageButton), are dynamically created based on which LinkButton is clicked out of a group of several links. I need each thumbnail to generate a full-size image on the page when clicked. I would use the ImageButton_Click event, but I need arguments other than X and Y positions. So I decided to use the _Command event, which is described (just as the _Click event) to fire when the button is clicked. This event gives me a CommandName and a CommandArgument to work with; however, it will not work. I have put both break points and a response.write() into the _Command event's stub and nothing occurs to indicate that it runs, though the _Click event does occur. My code is below:

Sub showThumbs(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim a As Integer = 0
Do
tblEvents.Rows(a).BackColor = Drawing.Color.White
tblEvents.Rows(a + 1).BackColor = Drawing.Color.LightBlue
a += 2
On Error Resume Next
Loop While a < RowNum
tblEvents.Rows(e.CommandName).BackColor = Drawing.Color.Aquamarine
tblEvents.Rows(e.CommandName).ID = "Selected"
Dim Conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("sysObjDBConnectionString").ConnectionString)
Dim Cmd As New Data.SqlClient.SqlCommand("SELECT event_photo_id FROM EVENT_PHOTO WHERE event_id =" & e.CommandArgument, Conn)
Dim EventRead As Data.SqlClient.SqlDataReader
Conn.Open()
EventRead = Cmd.ExecuteReader
Dim Thumb As ImageButton
Dim TR As TableRow
Dim TC As TableCell
Dim x As Integer = 0
Dim y As Integer = 0
While EventRead.Read
x += 1
If x = 4 Then x = 1
If x = 1 Then
y += 1
If …
ChimpusDupus 0 Light Poster

I tried something similar to this I think but I still couldn't obtain the value from the dropdown list and the dropdown list was blank after the PostBack. Though I'll try it again and see what happens I guess...

ChimpusDupus 0 Light Poster

I believe you can also do the following:

cboName.Items.Add(new listitem("Other","0"))

'item_name' would be the name of the item you want to add

And, another option for hard-coding the first entry, or the first several entries is to add the entries on the actual .aspx page in the <asp:listitem> tags, and then set the cboName's AppendDataBoundItems property to true. Though that's just a personal preference.

ChimpusDupus 0 Light Poster

Hi,

I've been trying to get this to work for hours to no avail (at least they're paying me :cheesy: ). I have a DropDownList that obtains its values from a database. The DropDownList will not retain it's values when a Postback is done (caused by a submit button being pressed), and I cannot use the .selectedindex or .selectedvalue properties in my coding, which are both very important. I think the reason this is happening is that the list binds the data to itself each time the page loads and the Load event occurs before all Postback Events, thus the dropdownlist is completely reset before the button's click event occurs. How can I work around this and use obtain the dropdownlist values I need?

-James Waltz

ChimpusDupus 0 Light Poster

Hi,

My name is James and I'm from Southern Maryland. I'm a junior in highschool and this summer I am working as a paid intern at Zekiah Technologies, working with ASP.NET. I have experience with VB6, some C++, some HTML/CSS/Javascript, and a little ASP.NET. I just bought Microsoft Visual Studio 2005 Standard and can't wait to start taking advantage of the new powers and create some programs that I've been wanting to make for a long time.

ChimpusDupus 0 Light Poster

Hi,

I've been wondering for a long time how one program can affect another program during run time by adding featues, retrieving information, submitting information and those sorts of things. One example of this might be a program like DeadAIM, which affects AOL Instant Messenger, or (doubtedly) if your in to Flight Simulator and VATSIM, programs like FSINN and SquawkBox.

How could I go about creating these types of programs. I have Visual Studio 2005 Standard Ed. and knowledge in C++ and VB.

-James