Thursday, March 29, 2012
Set columns in dataGrid
//Perform search
xslt.Transform(new XPathDocument(Server.MapPath("TIPTREECAT.xml")), xslArg,
sw, null);
StringReader sreader = new System.IO.StringReader("<root>" + sw.ToString() +
"</root>");
this.dataSet.ReadXml(sreader);
this.DataGrid.DataSource = dataSet;
this.DataGrid.DataBind();
How can I change colums I want to show in the grids? I want to show less
columns then there are in an xml data.
Thanksset the AutoGenerateColumns property to False. Then create column templates
for each column you want to display. The simplest version if this is the
BoundColumn:
<asp:BoundColumn DataField="FName"></asp:BoundColumn
You can also right-mouse click the datagrid and go to Property Builder.
This utility will help you set up your datagrid.
"Mark Goldin" <markgoldin@.comcast.net> wrote in message
news:eV#EXH0#DHA.3668@.TK2MSFTNGP09.phx.gbl...
> I have this code:
> //Perform search
> xslt.Transform(new XPathDocument(Server.MapPath("TIPTREECAT.xml")),
xslArg,
> sw, null);
> StringReader sreader = new System.IO.StringReader("<root>" + sw.ToString()
+
> "</root>");
> this.dataSet.ReadXml(sreader);
> this.DataGrid.DataSource = dataSet;
> this.DataGrid.DataBind();
>
> How can I change colums I want to show in the grids? I want to show less
> columns then there are in an xml data.
> Thanks
What is "BoundColumn"?
"Bob Boran" <mcsdsmurf@.hotmail.com> wrote in message
news:eEkdDc0#DHA.3220@.TK2MSFTNGP10.phx.gbl...
> set the AutoGenerateColumns property to False. Then create column
templates
> for each column you want to display. The simplest version if this is the
> BoundColumn:
> <asp:BoundColumn DataField="FName"></asp:BoundColumn>
> You can also right-mouse click the datagrid and go to Property Builder.
> This utility will help you set up your datagrid.
>
> "Mark Goldin" <markgoldin@.comcast.net> wrote in message
> news:eV#EXH0#DHA.3668@.TK2MSFTNGP09.phx.gbl...
> > I have this code:
> > //Perform search
> > xslt.Transform(new XPathDocument(Server.MapPath("TIPTREECAT.xml")),
> xslArg,
> > sw, null);
> > StringReader sreader = new System.IO.StringReader("<root>" +
sw.ToString()
> +
> > "</root>");
> > this.dataSet.ReadXml(sreader);
> > this.DataGrid.DataSource = dataSet;
> > this.DataGrid.DataBind();
> > How can I change colums I want to show in the grids? I want to show less
> > columns then there are in an xml data.
> > Thanks
Check the following link for sample and explanation of a boundcolumn. (watch for line wrap
http://samples.gotdotnet.com/quicks...rid.aspx#column
HTH
Suresh
-- Mark Goldin wrote: --
What is "BoundColumn"
"Bob Boran" <mcsdsmurf@.hotmail.com> wrote in messag
news:eEkdDc0#DHA.3220@.TK2MSFTNGP10.phx.gbl..
> set the AutoGenerateColumns property to False. Then create colum
template
> for each column you want to display. The simplest version if this is th
> BoundColumn
>><asp:BoundColumn DataField="FName"></asp:BoundColumn>>> You can also right-mouse click the datagrid and go to Property Builder
> This utility will help you set up your datagrid
>>> "Mark Goldin" <markgoldin@.comcast.net> wrote in messag
> news:eV#EXH0#DHA.3668@.TK2MSFTNGP09.phx.gbl..
>> I have this code
>> //Perform searc
>>>> xslt.Transform(new XPathDocument(Server.MapPath("TIPTREECAT.xml"))
> xslArg
>> sw, null)
>>>> StringReader sreader = new System.IO.StringReader("<root>"
sw.ToString(
>> "</root>")
>>>> this.dataSet.ReadXml(sreader)
>>>> this.DataGrid.DataSource = dataSet
>>>> this.DataGrid.DataBind()
>>>>>>>> How can I change colums I want to show in the grids? I want to show les
>> columns then there are in an xml data
>>>> Thank
>>>>>>
Monday, March 26, 2012
Set field to null
How can I set it to DBNull?
I have tried the following but It doesnt work.
You may try this:Dim updateSOrder As String = "Update SOrders set confirm_id = @dotnet.itags.org.confirmId where SOrder ='" & lblConfirmOrder.Text & "'"
Dim SaveDelete As SqlCommand
SaveDelete = New SqlCommand(updateSOrder, oConnection)Dim blank As DBNull
SaveDelete.Parameters.Add(New SqlParameter("@dotnet.itags.org.ConfirmId", SqlDbType.NVarChar, 40))
SaveDelete.Parameters("@dotnet.itags.org.ConfirmId").Value = blankSaveDelete.ExecuteNonQuery()
SaveDelete.Parameters("@.ConfirmId").Value = DBNull.Value
Saturday, March 24, 2012
Set focus on null fields!
I have a login form and I have two text boxes in it and the user is required to enter data in the textboxes.If they fail to enter data in any one of the text box and hit the submit button I would like for the cursor to setfocus on the empty text box for the user to enter the data.How would I do this in asp.net.If not would I be able to write Javascript and call the function and where would I call the function.COuld someone expalin how to accomplish this.I do know how to set focus on the first textbox when the page loads up.But I am lost when I am required to setfocus the cursor at the empty text box for user entry?try this:
string strScript = null;
strScript = "<script language=javascript> document.all('TextBox1').focus() </script>";
RegisterStartupScript("focus",strScript);
HI Azam,
I am getting a synatax error. Do I have to declare strScript in my Dim?Also is this a subroutine all by itself or is it part of another subroutine(like page_load)?
Hi,
try to put this code on the Server Side Button Click event.
HI Azam,
I tried your way but I get the error message that says strString is not declared.Also in your code the "TextBox1" would be the ID for the text boxes I have in my project Right?
declare strString as a string variable.
like this:
string strString = "whatever"; // C# syntax
Yes "TextBox1" is the id for the textboxes you have in yr project.
HI Azam,
I am doing this in VB .would the codes be any different if it is VB.
Only syntax.
Here is aC# to VB.NET converter.
HI Azam,
If I did it by your codes would I be able to set focus on the null fields or just the first text box.I am so many error message and that's why I could not see the results.Could you please mail me regarding this?Thanks.
Hi Picky,
Thanks.That is a cool tool!