-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: aamirOnline
Message 3 in Discussion
Hi Bipin I assume that you are using Web Datagrid. here is the solution. just follow
the steps You will have to create template columns for making postback events
I have created one column datagrid for you. you can add as many
<Columns>
<asp:TemplateColumn SortExpression="au_lname" HeaderText="Name">
<ItemTemplate>
<div id="col2" style="width:100%; height:100%"
onclick="<%#Page.GetPostBackEventReference(new Control(),"row_" +
(i++).ToString())%>">
<%#DataBinder.Eval(Container.DataItem,"au_lname")%>
</div>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<SelectedItemStyle BackColor="#ffcc00"></SelectedItemStyle>
you can see that there is <div> wrapper for the value in the column. this
<div> will generate postback event while generating postback event handler i am
passing row_{row number} as an argument, row number {i} is an integer protected
variable defined in base class you must have got idea about the structure, now
coding in the base class in the page_load handler write the following code
try
{
string args = Request["__EVENTARGUMENT"].ToString(); //args = row_0 or row_1
....
if(args.Substring(0,4) == "row_")
{
int index = Int32.Parse( args.Split('_')[1]); // Parse the row number
DataGrid1.SelectedIndex = index; //Change the selected index of the
datagrid
}
}
catch(Exception){}
Rember exception handling is necessary because with some postback
Request["__EVENTARGUMENT"] is null
Hope you got the answer
regards
m aamir maniar
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]