By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,060 Members | 1,906 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,060 IT Pros & Developers. It's quick & easy.

display database values in textboxes and pass parameter in response.redirect

P: 3
Hello Guys,

I have a datbase with userid,username and password.
I Need to display database values in textboxes say for eg(Name and password) and redirect to login page based on the UserID please need a help

Thanks
Surag
Sep 9 '10 #1
Share this Question
Share on Google+
7 Replies


Frinavale
Expert Mod 5K+
P: 9,731
I'm not sure what you're having problems with?

To display text in a TextBox set the TextBox.Text property to the text that you want to display.

To pass values from one page to another you could use Session, or you could pass the information via the URL during the redirect. I wouldn't recommend using the URL though because you're dealing with password information...well unless you passed the UserID via the URL and retrieved the password based on that value in the page that you are redirecting to.

Please elaborate on what you are trying to do and what you have done so far to solve the problem.

-Frinny
Sep 9 '10 #2

P: 3
Hi,
Thanks for replying me!!
am listing you with detail ,am using repeater control and displaying database values and even able to delete the selected values!!
want i want to do is once if any user selects any record from repeater control and clicks add button the selected record should be inserted in the user table followed wth the selected items id!!

so i need to redirect frm my login page to rptr control page and select any item from repeater control(using check box) and click add button so tht it will add to my tble!!
i even tried using sessions but am unable to do it please help me out

Thanks
surag
Sep 9 '10 #3

Expert 100+
P: 390
Try something like this
Expand|Select|Wrap|Line Numbers
  1. foreach (RepeaterItem dataItem in RepeaterName.Items)
  2. {
  3. CheckBox chk =(CheckBox)dataItem.FindControl("yourcheckboxname") ;
  4.  
  5. TextBox txt =(TextBox)dataItem.FindControl("yourTextboxname"); 
  6. if (chk.Checked)
  7. {
  8.  
  9. DoInsert(txt.Text);
  10. }
  11. }
I have assumed you are displaying data in textbox inside repeater.You can use the above code for your control
Sep 9 '10 #4

Frinavale
Expert Mod 5K+
P: 9,731
surag: I am using repeater control and displaying database values and ...
want i want to do is once if any user selects any record from repeater control and clicks add button the selected record should be inserted in the user table followed wth the selected items id!!
Inserted where?
Where is the user table?

Are you retrieving data from one table in your database, and adding these records (if selected) to another table in the database?

Or are you retrieving data from your database, and then when the user clicks the "add" button, you want to add this record to a table (in memory) that is simply displayed to the user (not added to the database)?

surag: so i need to redirect from my login page to repeater control page and select any item from repeater control(using check box) and click add button so tht it will add to my tble!!
I really don't understand how redirecting ties into the "add-record" part of your question.

Typically a user logs in and they are redirected into the website (allowed access to the rest of the pages in the site).

Why do you have to redirect the user once the add-button is clicked??

-Frinny
Sep 9 '10 #5

P: 3
hi Frinny,
thnaks for replying me,and
Thanks for ur patience! i thnk i confused u, oops!!sorry, let me eloborate wth examples:
in sql database i have 3 tables

Usertable: UserID,Uname,PWd
ContentTable: ContentID,Contentname
COmmontabel-UserID: ContentID(this is crucial)
(storing userid,and contentid i thnk u got my poin here)

now cmmng to .aspx pages
i have default.aspx with login control,
once user click on login (in databse checks for username and password if usernme and pwd are same )
and redirects to home.aspx

in home.aspx i have got repeater control which displays all the (contenttable data) and addbutton

so when user checks "check box" in repeater control and clicks "addbutton" based on his UserId(wth wch he login)
data should be inserted into Commontable(i.e UserId,ContentID)
Hpe u understand this time :(

Thanks
surag
Sep 9 '10 #6

Frinavale
Expert Mod 5K+
P: 9,731
Ah now I understand.

Ok, when the user logs in, save the user's ID in Session before you redirect them to the home.aspx page.

Then in the home.aspx page you can retrieve the user's ID from session (if it's not there then you know the user is not logged in and you can redirect the user back to the default.aspx page).

You should probably retrieve the User's ID from Session in the Page Load event, check if it's nothing...and if it is nothing redirect the user back to the default.aspx page. Otherwise, you can allow the rest of the page to execute properly.

So, now that I understand the general flow of the, what are you having problems with exactly?

Are you having problems handling the "AddButton" click event?

Are you having problems with database stuff??

It would probably be best if you posted the code that you are having problems with so that we can work with what you have (at this point I'm not even sure if you're using C# or VB.NET)

-Frinny
Sep 9 '10 #7

P: 98
how to handle button click event at here
as there are so many buttons but a common function has to be written
Sep 14 '10 #8

Post your reply

Sign in to post your reply or Sign up for a free account.