Hi All,
Thanks Mathew Let me explain clearly for all i still need som more clear explanation
I am developing a DNN Module which has several links and can be redirected to the corresponding site when clicked on the link. There are different Types of links displayed based on the settings. Types of Links are Normal Text Link (where a text desc is given and the url is typed for which it has to be redirected) and there will an image displayed instead of Text desc and for this also there will be url given for which it has to be redirected to also we can pass the parameters which are also defined and the format for the url will be given like this (http://www.xyz.com?{Tag1}={Tag2}) where the values of tag1 and tag2 are also defined. I amable to do it through navigate url perfectly.
By placing place holders and setting the visible conditions in the temlate column i am able to do it
The problem is now i have another link type http post where the url format is given similarily but the thing is parameters should not be visible here since it must be done through post method. How can i achieve this . i sat on it since last 2 days with no success. Please provide some sample code on how to achieve this. I can retrieve the parameters and url successfully on click event of the link through databind i have called this But how can i redirect it please provide some sample code
I am posting my code here to give you a better idea
My Datagrids template column has the following
<asp:TemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
<Itemtemplate>
<asp:PlaceHolder ID="PlaceHolder9" runat="server" Visible='<% # IIf((Eval("LinkType") = 3 and (Eval("RedirectId") = rue)),true,false)%>'>
<asp:ImageButton Runat="server" ID="lnkHttpPost" OnCommand="lnkHttpPost_Command" ImageUrl='<% #Eval("ImagePath") %>' style="border:0px" CommandName='<%# DataBinder.Eval(Container, "DataItem.UrlId")%>' />
</asp:PlaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
And my code behind file has the following
Protected Sub lstUrls_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles lstUrls.ItemDataBound
Dim lnkDeleteUrl As ImageButton
lnkDeleteUrl = CType(e.Item.FindControl("lnkDeleteUrl"), System.Web.UI.WebControls.ImageButton)
If Not lnkDeleteUrl Is Nothing Then
ClientAPI.AddButtonConfirm(lnkDeleteUrl, Localization.GetString("DeleteItem.Text", LocalResourceFile))
End If
Dim lnkHttpPost As ImageButton
lnkHttpPost = CType(e.Item.FindControl("lnkHttpPost"), System.Web.UI.WebControls.ImageButton)
End Sub
Protected Sub lnkHttpPost_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
postUrl(e.CommandName)
End Sub
Sub postUrl(ByVal UrlId As Integer)
If Not Null.IsNull(UrlId) Then
Dim Tag, TagValue As String
Dim objGetUrl As RedirectInfo
objGetUrl = RedirectController.GetRedirectUrl(UrlId)
Dim HttpPostImagePath As String
HttpPostImagePath = objGetUrl.URLformat
While objGetUrl.URLformat.IndexOf("{") > 0 AndAlso objGetUrl.URLformat.IndexOf("}") > objGetUrl.URLformat.IndexOf("{")
Tag = objGetUrl.URLformat.Substring(objGetUrl.URLformat.IndexOf("{") + 1, objGetUrl.URLformat.IndexOf("}") - objGetUrl.URLformat.IndexOf("{") - 1)
TagValue = GetTagValue(Tag)
objGetUrl.URLformat = objGetUrl.URLformat.Replace("{" & Tag & "}", TagValue)
End While
Dim MainString As String = objGetUrl.URLformat
Dim Split As String() = MainString.Split(New Char() {"?"})
posturlstring = Split(0)
postparameters = Split(1)
where posturl gets the website url (http://www.xyz.com) and post params gets the parameters based on values like (option=com_content&viewid=23) etc
I have written it like this can anybody please help on this i need it really quickly
Thanks,
Sandeep.M