Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Microsoft Web Control in ASP .NET - UREGENT

Status
Not open for further replies.

DilipKS

Programmer
Mar 8, 2004
30
CH
Hi
Anyone used Microsoft Web Browser Control in ASP .NET application ??
I tried to use it in .NET Windows Form and VB , it works fine, But in ASP .NET Webform I am not able to use it. I cant get the object or pointer to Web browser control.
Above link shows how to use it in C# and VB , but it works for Windows Forms , not in ASP .NET Form.
Any Clue ?
 
Hi there!
Corect me if I'm wrong: are you trying to make a browser to work inside of a browser?
Maybe I'm not explaining to good, but this is how I understand those things : as the name WindowsForm sugests that you need an OS (Windows) to run the application, WebForm sugests aswell that you need a Web Browser to "run" the application.

[morning]
 
Hi Joulius
I am working on an ASP .NET application using c#. In that there is a WebForm ( which will run in the browser ), in that WebFrom am using several text/label/grid controls. I have requirement that I need to display XML file as IE view ( when u open an XML file you get IE view ..try it ).
For that I am using this "Microsoft Web Browser" control. In this control if you set the property "Navigate" to the XML file name, at run time it will give XML view same as IE.
The problem is am not able to give the XML file name ad design time with this control ..I cant set it at run time like i managed to did in Windows .NET application or VB App. As you can see an example -
Is that makes u clear wat am trying to to ?
 
Hi Joulius
I am working on an ASP .NET application using c#. In that there is a WebForm ( which will run in the browser ), in that WebFrom am using several text/label/grid controls. I have requirement that I need to display XML file as IE view ( when u open an XML file you get IE view ..try it ).
For that I am using this "Microsoft Web Browser" control. In this control if you set the property "Navigate" to the XML file name, at run time it will give XML view same as IE.
The problem is am able to give the XML file name at design time with this control ..but I cant set the XML file name at run time like i managed to did in Windows .NET application or VB App. As you can see an example -
Is that makes u clear wat am trying to to ?
 
Why don't you just open another browser window.

Dim sURL As String = """XMLFileName.xml"""
Dim sName As String = """XML File"""
Dim sScript As String = "window.open" & "(" & sURL & ")" & "," & sName

Response.Write("<SCRIPT Language=VBScript>" & vbCrLf)
Response.Write(sScript & vbCrLf)
Response.Write("window.close" & vbCrLf)
Response.Write("</SCRIPT>")

The above example closes the current window, but that would be optional. Becareful, pop up blockers will stop this from working. I am not sure about the sURL format needed.

Hope this helps.

Hope everyone is having a great day!

Thanks - Jennifer
 
Hi Jennifer,

Thanks for your reply. Anyways I have achieved that view using XML .NET server control . As per my requirement I need to show that view in same window i.e. inside a Tab control not in another window.

Rgds
Dilip
 
Glad to hear that you got it to work.

Hope everyone is having a great day!

Thanks - Jennifer
 
Hi Jennifer...
see below problem and if u can help me in that...
I am using DataGrid with two columns, one column is read only having label inside and second column having text box inside. ( am using Template column ).
Both columns are bind to data columns ( see the code below ).
But the problem am facing is when am updating values in second column i.e. Text boxes and trying to retrieve it and getting old values .

am trying to use
TextBox txtVal = (TextBox)this.DataGrid1.Items.FindControl("txtValue");
But txtVal.Text is giving me old values ...
Any Idea ?




<asp:TemplateColumn HeaderText="Field">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:Label id="lblField" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Field") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Value">
<ItemStyle BackColor="LightGray"></ItemStyle>
<ItemTemplate><asp:TextBox id=txtValue runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Value") %>' EnableViewState="False"></asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
 
Can you copy the code where you are calling the code that you used, including the event.

Here is the code for one of my datagrid update command events.

Private Sub dgDetailLines_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgDetailLines.UpdateCommand
Dim strDetailID, strExpTypeID, strAmt, strItemNotation, strName, strNature, strPercent, strAmtAlloc, strPaidBy As String

strDetailID = dgDetailLines.DataKeys(e.Item.ItemIndex)
strExpTypeID = CType(e.Item.Cells(3).Controls(1), DropDownList).SelectedValue
strItemNotation = CType(e.Item.Cells(4).Controls(1), TextBox).Text
strAmt = CType(e.Item.Cells(5).Controls(1), TextBox).Text
strName = CType(e.Item.Cells(6).Controls(1), TextBox).Text
strNature = CType(e.Item.Cells(7).Controls(1), TextBox).Text
strPercent = CType(e.Item.Cells(8).Controls(1), DropDownList).SelectedValue
strAmtAlloc = CType(e.Item.Cells(9).Controls(1), TextBox).Text
strPaidBy = CType(e.Item.Cells(10).Controls(1), CheckBox).Checked

UpdateDetailLineRecord(strDetailID, strExpTypeID, strAmt, strItemNotation, strName, strNature, strPercent, strAmtAlloc, strPaidBy)
dgDetailLines.EditItemIndex = -1
LoadDetailGrid(txtDetailID.Text)
LoadMain()
End Sub

Hope everyone is having a great day!

Thanks - Jennifer
 
Hi Jennifer,
Thnks for you reply. And again I got my problem fixed as soon as I got ur reply. :):)
Actually I was not using the inbuilt functionality of Grid as you suggested in ur reply.
I have an update button and am doing multi line editing.
I have formed a 2 column Grid one column containts read only columns and other contains editable text boxes.
My problem of not getting values from Grid was solved by once I have used "EnabledViewState=False" .
Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top