Click here to Skip to main content
15,929,025 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Complex security + role based Pin
chopps27-Jul-06 11:46
chopps27-Jul-06 11:46 
QuestionDynamically created controls disappearing Pin
toptone7827-Jul-06 6:38
toptone7827-Jul-06 6:38 
AnswerRe: Dynamically created controls disappearing Pin
ToddHileHoffer27-Jul-06 6:59
ToddHileHoffer27-Jul-06 6:59 
GeneralRe: Dynamically created controls disappearing Pin
toptone7827-Jul-06 7:42
toptone7827-Jul-06 7:42 
GeneralRe: Dynamically created controls disappearing Pin
toptone7827-Jul-06 7:49
toptone7827-Jul-06 7:49 
GeneralRe: Dynamically created controls disappearing Pin
ToddHileHoffer27-Jul-06 7:57
ToddHileHoffer27-Jul-06 7:57 
QuestionDatagrid Pin
sunilkgopinath27-Jul-06 6:37
sunilkgopinath27-Jul-06 6:37 
AnswerRe: Datagrid Pin
ToddHileHoffer27-Jul-06 6:56
ToddHileHoffer27-Jul-06 6:56 
What you need to do is save the DataTable in the viewstate and rebind the grid after the save button is clicked.

I have a user control I wrote that does this so here is some sample code. It starts off with an empty grid. Below is the method that creates the initial datatable and stores it in view state.



<br />
void intiGrid()<br />
    {<br />
        DataTable dt = new DataTable();<br />
        DataColumn c = new DataColumn();<br />
        c.ColumnName = "ClassCode";<br />
        c.DataType = System.Type.GetType("System.String");<br />
        dt.Columns.Add(c);<br />
        <br />
<br />
        c = new DataColumn();<br />
        c.ColumnName = "Required";<br />
        c.DataType = System.Type.GetType("System.Boolean");<br />
        dt.Columns.Add(c);<br />
<br />
        c = new DataColumn();<br />
        c.ColumnName = "ClassDesc";<br />
        c.DataType = System.Type.GetType("System.String");<br />
        dt.Columns.Add(c);<br />
        DataRow row;<br />
        row = dt.NewRow();<br />
        row[0] = "New";<br />
        row[1] = true;<br />
        row[2] = "";<br />
        dt.Rows.Add(row);<br />
<br />
        DataColumn[] columns = new DataColumn[1];<br />
        columns[0] = dt.Columns["ClassCode"];<br />
        dt.PrimaryKey = columns;<br />
        <br />
        this.GVRequiredClassCodes.DataSource = dt;<br />
        this.GVRequiredClassCodes.DataBind();<br />
        ViewState[this.ClientID.ToString() + "DataTable"] = dt;<br />
    }<br />


This next snippet is how I add a new row to the grid.
<br />
  DataTable DT = new DataTable();<br />
           DT = (DataTable) ViewState[this.ClientID.ToString() + "DataTable"];<br />
           DataView DV = new DataView(DT);<br />
           DV.Sort = "ClassCode";<br />
<br />
 //Add the new classcode and bind to the gridview<br />
            DataRow R;<br />
            R = DT.NewRow();<br />
            R[0] = sNewClassCode;<br />
            R[1] = cb.Checked;<br />
            R[2] = classDescription;<br />
            DT.Rows.Add(R);<br />
            this.GVRequiredClassCodes.DataSource = DV;<br />
            this.GVRequiredClassCodes.DataBind();<br />
            ViewState[this.ClientID.ToString() + "DataTable"] = DV.ToTable();<br />




how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06

QuestionMaster page menu click event handleable by content? Pin
Member 9627-Jul-06 5:56
Member 9627-Jul-06 5:56 
AnswerRe: Master page menu click event handleable by content? Pin
Not Active27-Jul-06 6:09
mentorNot Active27-Jul-06 6:09 
AnswerRe: Master page menu click event handleable by content? [modified] Pin
ToddHileHoffer27-Jul-06 6:17
ToddHileHoffer27-Jul-06 6:17 
GeneralRe: Master page menu click event handleable by content? Pin
Member 9628-Jul-06 4:57
Member 9628-Jul-06 4:57 
AnswerRe: Master page menu click event handleable by content? Pin
minhpc_bk27-Jul-06 16:13
minhpc_bk27-Jul-06 16:13 
Questionhey , i wanna select multiple rows in the gridview Pin
Mohammed Amine27-Jul-06 5:39
Mohammed Amine27-Jul-06 5:39 
AnswerRe: hey , i wanna select multiple rows in the gridview Pin
Not Active27-Jul-06 6:00
mentorNot Active27-Jul-06 6:00 
GeneralRe: hey , i wanna select multiple rows in the gridview Pin
Mohammed Amine27-Jul-06 6:05
Mohammed Amine27-Jul-06 6:05 
QuestionI want to only allow users to use IE exclusively Pin
widget127-Jul-06 5:13
widget127-Jul-06 5:13 
AnswerRe: I want to only allow users to use IE exclusively Pin
_AK_27-Jul-06 5:15
_AK_27-Jul-06 5:15 
GeneralRe: I want to only allow users to use IE exclusively Pin
Colin Angus Mackay27-Jul-06 5:57
Colin Angus Mackay27-Jul-06 5:57 
GeneralRe: I want to only allow users to use IE exclusively Pin
widget127-Jul-06 7:21
widget127-Jul-06 7:21 
AnswerWell lets see Pin
Ennis Ray Lynch, Jr.27-Jul-06 5:28
Ennis Ray Lynch, Jr.27-Jul-06 5:28 
GeneralRe: Well lets see Pin
_AK_27-Jul-06 5:33
_AK_27-Jul-06 5:33 
QuestionIs it possible to store data in database Pin
sabby200627-Jul-06 4:59
sabby200627-Jul-06 4:59 
AnswerRe: Is it possible to store data in database Pin
_AK_27-Jul-06 5:17
_AK_27-Jul-06 5:17 
AnswerRe: Is it possible to store data in database Pin
J4amieC27-Jul-06 5:18
J4amieC27-Jul-06 5:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.