Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem response.redirect

Status
Not open for further replies.

Borracho1

Programmer
Apr 2, 2005
28
BE
Hi i've made a webpage which i want to display the text on the buttons in the language of the person that is logged in. I can do this by using a repeater but then when you click one of the buttons everything between my repeater becomes invisible.

If someone has an idea of what i have to change in my code.

Sub Button1_Click(sender As Object, e As EventArgs)
Response.redirect("Personeel2.aspx")
End Sub

the following is the code that i use to populate the repeater, i don't think that this gives the error but i posted it anyway.

Dim toConn as oledbconnection
Dim toCmd As OleDbCommand
Dim tsSQL As String

toConn = new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Inetpub\toConn.open()
dim intac as integer
intac = cint(val(strx))
tsSQL = "SELECT * FROM tbltaal WHERE [TaalID] = " & intac
toCmd = New OleDbCommand(tsSQL, toConn)

'Dim toDA As new OleDbDataAdapter (tocmd)
'Dim toDS As New DataSet
'Get a datareader
Dim objDataReader as OleDbDataReader
objDataReader = toCmd.ExecuteReader(CommandBehavior.CloseConnection)

rptTaal.DataSource = objDataReader
rptTaal.DataBind()

objDataReader.Close()
toConn.close()

and the following between the body tags, which is probably the problem with the onclick event but i have no idea what i have to change

<asp:Repeater ID="rptTaal" runat="server" EnableViewState="false">
<ItemTemplate>
<asp:Button ID="Button1" runat="server" Text='<%# Container.DataItem ("Button1") %>' onclick="Button1_Click" Width="100" Height="30" ></asp:Button><br>

</ItemTemplate>
</asp:Repeater>

So everything works apart but not together.
Already thanks.

Borracho
 
Did you use the IsPostback in your page load event?

Hope everyone is having a great day!

Thanks - Jennifer
 
yes i used it and put the code above in the binddata() function

Sub page_load(Sender As Object, E As EventArgs)
If Not Page.IsPostBack then
BindData()
End If
 
Try setting the ViewState to True - just a guess.

Good Luck.

Hope everyone is having a great day!

Thanks - Jennifer
 
No it isn't this either. I added EnableViewState="true" to my binddata() function.

But still everything between my repeater turns invisible of i click on one of my buttons.

 
How about in the HTML

Code:
<asp:Repeater ID="rptTaal" runat="server" EnableViewState="false">
  <ItemTemplate>
  <asp:Button ID="Button1" runat="server" Text='<%# Container.DataItem ("Button1") %>' onclick="Button1_Click" Width="100" Height="30" ></asp:Button><br>

If not maybe someelse has an idea?

Hope everyone is having a great day!

Thanks - Jennifer
 
Well the button is in a repeater so instead of using the onclick command on the button within the repeater you should use the repeater's itemcommand event and assign the button a commandname...

Code:
<asp:Repeater ID="rptTaal" runat="server" EnableViewState="false" OnItemCommand="Button1_Click">
 
Thanks a lot for the last two reply's when i used them together the onitemcommand and the enableviewstate of the repeater i finally got it to work.

Thanks a lot both of you for the reply.

So I finally have a great day.

Thanks alot

Borracho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top