We help IT Professionals succeed at work.

ASP.Net click on a phone link open it on the dial pad

Hi Experts,

I have a gridview in which one column is phone number. When I click on the phone link I want it to open on the phone's dial pad. My code is in VB.NET.

Thank you.
Comment
Watch Question

Kyle AbrahamsSenior .Net Developer

Commented:
have you tried using the tel: link?

<a href="tel:1235557789">Test Phone</a>
Maheshwar RSoftware Developer

Commented:
if your opening the webpage on the phone then you need to provide "tel:" in the grid view column style

Author

Commented:
Thank you very much for your reply. The following is my code. Can you please tell me how to use "tel" in my code.

<asp:TemplateField HeaderText="Business Phone">
                        <HeaderStyle Width="5%" />
                        <ItemStyle Width="5%" />
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        <ItemTemplate>
                             <asp:LinkButton  ID="lblBusinessPhone" runat="server" Text='<%#Eval("BusinessPhone")%>' ></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
Most Valuable Expert 2012
Top Expert 2014

Commented:
*No Points*
*Untested Code*

Try

<asp:TemplateField HeaderText="Business Phone">
                        <HeaderStyle Width="5%" />
                        <ItemStyle Width="5%" />
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        <ItemTemplate>
                             <a href='<% string.format("tel:{0}", #Eval("BusinessPhone") %>'>'<%#Eval("BusinessPhone")%>'</a>
                        </ItemTemplate>
                    </asp:TemplateField>

Author

Commented:
Thank you for ur reply. But it is not working. In this line I am getting an error.

'<% string.format("tel:{0}", #Eval("BusinessPhone") %>'

Near hash it says expression required. Please help.
Senior .Net Developer
Commented:
'<%# string.format("tel:{0}", Eval("BusinessPhone") %>'

Author

Commented:
Thank u.