Jump to content

swine

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by swine

  1. Hello, I have a repeater with a hidden button. Using the ItemCommand Event in code behind, I used a MsgBoxStyle.OkCancel asking if user wants to continue his action. If user clicks ok, a stored procedure is called, writing some data in DB. I uploaded the application to the webserver and repleaced the MsgBox with a javascript confirm box in code behind.I'm facing two problems right now. First: How can I access the Ok Click Event from the confirm box? Second: The confirm box appears, but the page reloads as well. How can I prevent the Postback? old:

    Dim intAnswer As Integer = MsgBox("Do you wish to continue?", _							  MsgBoxStyle.OkCancel)If intAnswer = vbOK TheninsertData()End If

    new:

    Page.ClientScript.RegisterStartupScript(Me.GetType, "confirm", "confirm('Do you wish to continue?')",True) 'If user clicks ok insertData()

    Thanks for your help.

  2. Hey there, I've already spent one day on this problem and still don't know what's wrong. I have a stored procedure giving me some project details. I want to save them into a list. So I created a project class.Using the SqlDataReader, I instantiate the project and put them in the list. Everything works fine, except one datafield. The values are always 0. But if I check the SQL, I'm getting the correct values. I really don't know, why this is happening.

    Dim cmd As New SqlCommandcmd.CommandText = "sao.GetProjects"cmd.CommandType = CommandType.StoredProcedurecmd.Connection = New SqlConnection(GetConnectionString)Using cmd.Connection	Using cmd		Dim projects As New List(Of clsProject)		cmd.Connection.Open()		Dim reader As SqlDataReader = cmd.ExecuteReader		While reader.Read			Dim project As New clsProjekt 			'This is the field		    project.employeeNo = reader("employeeNo") 			'Always get Empty			If project.employeeNo = 0 Then				Debug.Print("Empty")			Else				Debug.Print(project.employeeNo)			End If			project.orderNo = reader("OrderNo")			project.description = reader("Description")			project.customer = reader("Customer")			projects.Add(project)		End While	End UsingEnd Using

    Thanks for helping

  3. Thanks for your answer. I've tried an ASP.NET LinkButton but it works not exactly how I need it. The selected Item doesn't remain selected, means doesn't switch color.

    <li runat="server" data-icon="false"><asp:LinkButton NavigateURL="~/index.aspx" OnClick="selectItem" runat="server" Text=<%#Eval("Employee")%>></asp:LinkButton></li>

    Maybe some further details will help:The Application has a splitview with employee names on the left, projects on the right. By clicking on a name the non-related projects should grey out.

  4. Thanks for the quick answer. I just tried a second SQL which is mostly the same, but only returns the names and distinct works fine.Unfortunately I don't have the skills to say if a php or a second sql is the better solution.

  5. Hey there, I have a SQL-statement in a stored procedure returning an employees name and his projects. The names are displayed in a list, and if an employee has n projects, his name is displayed n-times. I want the names to displayed only once, but still n projects. So if I click later on a name, his projects are highlighted or alternatively the others are greyed out. Is there a possibility to get this with only one SQL-statement? I've tried with "select distinct ..." but this doesn't cause any change Thanks for helping

  6. Hi there, I'm new on ASP.NET and have the following problem: I get some data from a MS SQL-Server using a stored procedure. To display the data I'm using <ul>, <li> in a Repeater, because I have to do some optical customization. Now I want to call a sub from the Code Behind file, by clicking on a List Item. Right now the ClickEvent should just cause a Console output, that the Item was clicked.But I'm getting an error, saying the sub is undefined. Here is the code:

    <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">						    <ItemTemplate>						   						    <li runat="server" onclick="selectItem" data-icon="false"><a href="index.aspx"><%#Eval("Employee")%></a></li>						   						    </ItemTemplate>						    </asp:Repeater>

        Public Sub selectItem(ByVal sender As Object, ByVal e As System.EventArgs)	    Console.WriteLine("Clicked")    End Sub

    Thanks for your help

×
×
  • Create New...