Anyone mind converting to vb.net? That's what I'm
using...
--- Amogh Lachake <[EMAIL PROTECTED]> wrote:
> Hii,
>
> try using something of this sort...
>
>
> foreach(DataGridItem i in dgUsers.Items)
> {
> i.ToolTip = "Test";
> cb1 = (CheckBox) i.FindControl("chkPush");
>
> cb1.Checked = false;
> if(sRBText==cb1.ClientID)
> {
> cb1.Checked = true;
> AdvID = i.Cells[4].Text.ToString();
> ViewState["advid"] = AdvID;
> break;
> }
> }
>
>
> On Thu, 14 Oct 2004 17:32:34 -0400, Rajendra Appalla
> <[EMAIL PROTECTED]> wrote:
> > Lets say the button the user presses after the
> user selects the row of
> > the correct address is "btn".
> >
> > btn.Attributes.Add("onclick", "return
> CheckBoxConfirm(this.form);");
> >
> > You can add a client side java script function
> that checks whether the
> > user checked atleast one check box in the datagrid
> or not as below:
> >
> > I hope you are using Template columns for the
> checkbox column in the
> > datagrid. Lets say the ID of the checkbox is:
> "chkSelect".
> >
> > function CheckBoxConfirm (frm)
> > {
> > var flag = false;
> >
> > for (i=0; i<frm.length; i++)
> > {
> > // Look for our checkboxes
> only
> > if
> (frm.elements[i].name.indexOf('chkSelect') !=
> > -1)
> > {
> > // If any are
> checked then confirm
> > alert, otherwise nothing happens
> >
> if(frm.elements[i].checked)
> > {
> >
> flag = true;
> >
> return confirm ('Are you
> > sure you want to delete your selection(s)?')
> >
> > }
>
> > }
> > }// end of for loop.
> >
> > alert('You have to Select at least one
> row. \n\n\n You can
> > Select row(s) by checking corresponding
> CheckBox(es).');
> > return flag;
> > }
> >
> >
> > You need to make sure that the user selects not
> more than one checkbox.
> > You can tweak above script to do that.
> >
> > I am assuming that you assign the primary key
> field of the table to the
> > DataKeyField property of the datagrid.
> >
> > In the btn_click event, you can get the primary
> key id of the row of
> > which the checkbox is clicked as follows:
> >
> > foreach(DataGridItem gridItem in
> dgTableView.Items)
> > {
> > CheckBox chk = (CheckBox)
> > gridItem.FindControl("chkSelect");
> > if(chk.Checked)
> > {
> > intPKID =
> >
>
Convert.ToInt32(dataGrid.DataKeys[gridItem.ItemIndex]);
> > break;
> >
> > }
> > }
> >
> >
> > Pass this primary key id to the form and in the
> form query the database
> > to get the values of the columns you need to
> display in the form.
> >
> > Rajendra.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: sas0riza [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 14, 2004 3:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: [AspNetAnyQuestionIsOk] Populating a Form
> >
> >
> > Hi,
> >
> > I'm using a search form to find an address. I then
> return it to the
> > screen in a datagrid. I've added a checkbox column
> and I want the
> > user to check the correct address and hit a
> button. How do I write
> > the code to see which checkbox was selected?
> >
> > After clicking the button, I want to take the row
> that the user
> > selected (address) and populate it into a form.
> How do I populate a
> > form from fields in the database?
> >
> > Thanks.
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> > click here
> >
>
<http://us.ard.yahoo.com/SIG=129v6ian9/M=315388.5500238.6578046.3001176/
> >
>
D=groups/S=1705006764:HM/EXP=1097868438/A=2372354/R=0/SIG=12id813k2/*htt
> >
>
ps:/www.orchardbank.com/hcs/hcsapplication?pf=PLApply&media=EMYHNL40F210
> > 04SS>
> >
> >
>
<http://us.adserver.yahoo.com/l?M=315388.5500238.6578046.3001176/D=group
> > s/S=:HM/A=2372354/rand=719079343>
> >
> > _____
> >
> > Yahoo! Groups Links
> > * To visit your group on the web, go to:
> >
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > * To unsubscribe from this group, send an
> email to:
> > [EMAIL PROTECTED]
> >
>
<mailto:[EMAIL PROTECTED]
> > cribe>
> >
> > * Your use of Yahoo! Groups is subject to
> the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/> .
> >
> >
> > [Non-text portions of this message have been
> removed]
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> >
> > ADVERTISEMENT
> >
> >
> > ________________________________
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> >
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> >
> > Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of Service.
>
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/