|
Hello
This is My code:
<asp:Repeater ID="myRepeater" runat="server">
<HeaderTemplate>
<table border="2">
<tr>
<td colspan="5" height="30"><asp:Label runat="server" ID="LblName" Text="dddddddddd"></asp:Label></td>
</tr>
<tr>
<td>Grade Name</td>
<td>Institution Name</td>
<td>AcomplishesYear</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem, "GradeName")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "InstitutionName")%></td>
<td><%#DataBinder.Eval(Container.DataItem, "AccomplishYearNum")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
what i want to do is to write instead "ddddddddddd" in the header a real Data comming from a Session?
it's mean how i can refer to this label in the repeater from the VB code
("I want to say sorry to christin Garus I didn't get his point" if he can clarify it to me, thanks christian)
Thanks in advance
Assaf
|
|
|
|
|
Assaf82 wrote: instead "ddddddddddd" in the header a real Data comming from a Session
You can feed the value of session to the Label from CodeBehind right?
Assaf82 wrote: christin Garus
His name is Christian Graus right?
|
|
|
|
|
How i can refer to the label inside the repeater, from the code behind
to set his value
-- modified at 11:00 Sunday 29th July, 2007
Assaf
|
|
|
|
|
Oh, I remember this now.
You keep asking questions in new threads, and each time, progress in trying to make sense of your question is lost. Please stick to a thread, so people can follow the things you fail to explain.
As I explained before, you can use the <% tags to call a method in your code behind, or just to grab the value from the session. If you couldn't follow that, you really should buy a good ASP.NET book and read it, because it's reasonably straightforward.
in your code behind
protected string GetValue()
{
string s = Session["theString"];
return s ?? ""; // This just returns "" if the string is null
}
in the aspx
Text='<%=GetValue()%>'
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, would you please point me to a good tutorial on authenticating a user with a database. I have read about user authentication using Web.Config but since it does not suit my need I would like to use database to authenticate my user. Thank you in advance for your help.
|
|
|
|
|
Are you trying to do this with database users or with a user table (containing username, password, etc) in the database?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi, I'm planning to store user names in the UserName field and passwords in the Password field of my Members table. Then I'm planning to check the text value of the TB_UserName text box and the value of TB_Password text box against the database. So I guess I'm using a user table. I don't know what else to do other than what I've just described. Thanks for your response.
|
|
|
|
|
You can go that route, then query for the username and password, if you have a match, great log the user on, if not tell them log on failed...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi thanks for your time, there is one thing that worries me about using the database to log someone in. Since I'm not using Web.Config I won't have cookie for tracking the use. Also suppose I redirect someone to a restricted page once they have been authenticated. Then later on after knowing what the url is, can he or she go there directly by copying the url of that page and pasting it into the url box?
-- modified at 2:15 Sunday 29th July, 2007
|
|
|
|
|
You need to have anything that uses the username and password to be done with the POST method and not GET. You can also implement a timeout period for your log ins. I think I remember mentioning to you in the past about Session variables, they can come in handy for this type of thing...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello Everybody
I dont have any idea about rss feed. Im doing a project which called HelpDesk. What I would like to do is,
1. Like CodeProject MessageBox. Every single user is able to put their message.
2. Top Message and so on......
Any help and guide line will be great help for me
Sarfarj Ahmed
|
|
|
|
|
Hi..
After adding header and footer usercontrols to all web pages in my asp.net 1.1 website some events are not fired any more (or may be not handled)like DataGrid events and DropDownList events(In many pages).I build the project many times but nothing changes.Could any one tell me Why adding header footer usercontrol cause this problem and how to solve it?.
-- modified at 20:18 Saturday 28th July, 2007
I am too late but i will never give up
|
|
|
|
|
I have been trying to create a user control that allows users to add and remove emails from their profiles and I havent been able to wrap my head around ViewState and Postbacks.
When the profile page is loaded there is one table row with 3 cells:
cell(0) contains two imagebuttons, one to add a new row and another to delete that particular row.
cell(1) contains a label
cell(2) contains a textbox to add the email
I want the user to click the add imagebutton to add a new row and the delete imagebutton to delete that particular row.
My problem is I cant seem to be able to add more than 2 rows. And if I click the buttons in the second row I don't seem to hit Click event handler for the clicked button.
Here is the code:
----------------------------------------------------
Imports System.Configuration
Public Class UC_Emails
Inherits System.Web.UI.UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents plcEmailTable As System.Web.UI.WebControls.PlaceHolder
Protected WithEvents tblUserEmails As System.Web.UI.WebControls.Table
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
AddEmailRow(maxEmails)
End Sub
#End Region
Dim maxEmails As Integer = CInt(ConfigurationSettings.AppSettings("MaxEmails"))
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
plcEmailTable.Controls.Add(tblUserEmails)
End Sub
Private Sub AddEmailRow(ByVal maxrows As Short)
If Not tblUserEmails.Rows.Count > maxrows Then
Dim eRow As New TableRow
'cells
Dim imgCell As New TableCell
Dim lblCell As New TableCell
Dim txtCell As New TableCell
Dim chkCell As New TableCell
'plus imagebutton
Dim plusImg As New ImageButton
plusImg.CssClass = "PlusMinusImage"
plusImg.ImageUrl = CType(Session("imagespath"), String).Replace(".", "~") & _
"btn_plus.jpg"
AddHandler plusImg.Click, AddressOf btnAdd_Click
'minus imagebutton
Dim minusImg As New ImageButton
minusImg.CssClass = "PlusMinusImage"
minusImg.ImageUrl = CType(Session("imagespath"), String).Replace(".", "~") & _
"btn_minus.jpg"
AddHandler minusImg.Click, AddressOf btnDelete_Click
'label
Dim lblEmail As New Label
lblEmail.Text = "Email:"
'text box
Dim txtEmail As New TextBox
txtEmail.CssClass = "EmailTextBox"
'primary check box
Dim chkPrimary As New CheckBox
chkPrimary.Text = "Primary email"
'add itrems to cells
imgCell.Controls.Add(plusImg)
imgCell.Controls.Add(minusImg)
lblCell.Controls.Add(lblEmail)
txtCell.Controls.Add(txtEmail)
chkCell.Controls.Add(chkPrimary)
'add cells to row
eRow.Cells.Add(imgCell)
eRow.Cells.Add(lblCell)
eRow.Cells.Add(txtCell)
eRow.Cells.Add(chkCell)
tblUserEmails.Rows.Add(eRow)
End If
End Sub
Private Sub DeleteEmailRow(ByVal sender As Object, ByVal remaminingRows As Integer)
If Not tblUserEmails.Rows.Count = 1 Then
Dim btnClicked As ImageButton = CType(sender, System.Web.UI.WebControls.ImageButton)
Dim row As TableRow
Dim cell As TableCell
cell = CType(btnClicked.Parent, TableCell)
row = cell.Parent
tblUserEmails.Rows.Remove(row)
End If
End Sub
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
AddEmailRow(maxEmails)
End Sub
Private Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
DeleteEmailRow(sender, tblUserEmails.Rows.Count)
End Sub
End Class
----------------------------------------------------------------
Please help in pointing out where I'm getting it wrong
-- modified at 13:21 Saturday 28th July, 2007
|
|
|
|
|
Viewstate is applied to the page's controls between Init and Load, so if you dynamically change your control in Page_Load, Viewstate won't be applied to them, and the page won't know what event caused the postback, and your event won't fire.
if you do this:
plcEmailTable.Controls.Add(tblUserEmails)
in PageInit instead, it should work.
-- modified at 13:53 Saturday 28th July, 2007
Duh, sorry, forget that. I see you're already doing your dynamic creation in PageInit. I read it too quickly.
|
|
|
|
|
If I add a dynamic control inside a user control in the UserControl's Page.Init method, and acoording to how I understand this the user control is loaded after the containing page's Load event ; how can i be able to add dynamic control on the user control into the containing page's ViewState???
|
|
|
|
|
I've done something very similar adding user controls to user controls, and the child user control's Init is fired as soon as it is added to the parent user control. It should be the same for Webcontrols.
I'm afraid I don't have any code in front of me, but will Monday, if you're still stuck by then I can paste some.
The best way to get the sequence of events firing is to set a breakpoing at every Init and Load in the hierarchy.
|
|
|
|
|
thanks, I'm still stuck though!!
|
|
|
|
|
Hello,
I want to iterate throught out the page controls and identify its type(button,textBox,.....etc) to set the text property but I can't.I've used this code
foreach (Control c in this.Controls)
{
Label1.Text = c.GetType().ToString();
}
but it doesn't work as expected.
thanks.
Dad
|
|
|
|
|
What do you expect that code to do, then?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello Everyone,
I want to run my uploaded videos in realplayer or quicktime or mediaplayer
in my program My videos can be flash files or anything else
Thnx & Regards
Manoj Bisht
|
|
|
|
|
Hello There,
I have technical problem in with web project.
I'm trying to pass form data (hidden fields) to a url without redirecting to the page.
In other words, lets suppose my web project has 2 files 1.aspx and 2.aspx.
A user submits a form on 1.aspx and the page navigates to 2.aspx. But before navigating to 2.aspx I'm validating the user inputted data. After the validation I need pass the status of validation(Valid or Invalid data) to an external url lets suppose http://somewebsite.com/3.aspx.
The posting of data to http://somewebsite.com/3.aspx has to happen asyncronously behind the scene so that user navigates from 1.aspx to 2.aspx.
Could anyone please help me...any reference to any articles will be of great help.
Thanks!
Amit.
Cheers!
Amit.
|
|
|
|
|
|
Hi Bardly,
Thanks for the prompt answer. however I have explored AJAX as one of the options to achieve the solution to my problem but not successful in doing it.
I got to pass the data to 3.aspx page on the load of 2.aspx page.
Would you suggest me to create an event to fire the Ajax code(which intern passes the data to 3.aspx) and I would still load 2.aspx as expected behaviour??
Cheers!
Amit.
|
|
|
|
|
Yes, I can't think of a way to do what you want in the Load event of 2.aspx, so I was thinking of firing off the Ajax request in 1.aspx, just before posting to 2.aspx, and the Ajax request keeps 3.aspx happy and the normal post keeps 2.aspx happy.
|
|
|
|
|
hi everyone
I have used hyperlink to show ModalPopup Panel through AJAX Toolkit ModalPopupExtender.
Hyperlink is image only but i have assigned no targeUrl but associted with ModalPopupExtender.
Hyperlink image shows ModalPopup panel very well but doesn't change the cursor from pointer. Please tell me how i can solve this problem?
Thank you.
|
|
|
|