C# How can I show the row number from my Grid

quest_capital
quest_capital used Ask the Experts™
on
I have a javascript that need to get the name of each of my textboxes in a dynamic gridview.
The name of the textbox in the sourcecode will end up like:
'textbox=ctl00$ContentPlaceHolder1$GridView1$ctl02$tb_CreationDate'
The only thing that changes for each of my textbox name is "ctl02" which represents the row of the grid.  
My javascript below needs the updated row number.
How can I ether:
1. Get the number placed in the javascript from the aspx page.
or
2. Just write the the javascript function with the dynamic row number placed in the code from the code behide page (.cs)
<asp:GridView 
.......
<script type="text/javascript">
                            function openCalendar1()
                            {
                              window.open('PopupCalendar.aspx?textbox=ctl00$ContentPlaceHolder1$GridView1$ctl02$tb_CreationDate','cal','width=220,height=200,left=270,top=180')
                            }
                        </script>
......

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Please explain from where you call this popup caledar function ?

Like onclick of each row or button in each row ?

Put some aspx over here.

Commented:
If inside grdiview



<asp:TemplateField>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick='<%# "return popup("+ Container.DataItemIndex.ToString() +");" %>'>LinkButton</asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>

Open in new window

I used a Litial tag in the code behind.

lt_cal.Text = "<script type=\"text/javascript\">";
        lt_cal.Text = lt_cal.Text + "function openCalendar1() {";
        lt_cal.Text = lt_cal.Text + "window.open('PopupCalendar.aspx?textbox=" + tb_CreationDate.ClientID.ToString() + "','cal','width=220,height=200,left=270,top=180')";
        lt_cal.Text = lt_cal.Text + " } </script>";

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial